• Hi, i’ve added an upsells tabs to my product page using the code found here:
    https://www.ads-software.com/support/topic/up-sells-in-a-tab?replies=9
    and it works perfectly apart from 1 small issue, the output displays in 2 columns.

    I’ve been trying to change the layout using this snippet, but it doesn’t work.

    if ( ! function_exists( 'woocommerce_output_upsells' ) ) {
    	function woocommerce_output_upsells() {
    	    woocommerce_upsell_display( 10,5 ); // Display 10 products in rows of 5
    	}
    }

    If anyone knows where i’m going wrong, please share.

    Best regards
    Darrell

    This the full code taken from the thread mentioned above.

    // Remove the WooCommerce Upsell hook
    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
    
    // Add a custom action to display Upsells
    add_action( 'growdev_after_single_product_summary', 'woocommerce_upsell_display', 15 );
    
    if ( ! function_exists( 'woocommerce_output_upsells' ) ) {
    	function woocommerce_output_upsells() {
    	    woocommerce_upsell_display( 10,5 ); // Display 10 products in rows of 5
    	}
    }
    
    // A filter to add a custom tab
    add_filter('woocommerce_product_tabs','growdev_add_tab');
    
    // Callback for add_filter that defines the filter. You can change 'New tab' to the desired
    // tab title
    // growdev_custom_tab is the function callback
    function growdev_add_tab( $tabs ) {
    	$tabs['upsell_tab'] = array( 'title' => 'Colours', 'priority' => 29,
    								 'callback' => 'growdev_custom_tab');
    	return $tabs;
    }
    
    // The function callback for the custom tab.
    // This does the display upsells action inside of the tab
    function growdev_custom_tab( $key, $tab ) {
    
    	do_action('growdev_after_single_product_summary');
    
    }

    https://www.ads-software.com/plugins/woocommerce/

  • The topic ‘Upsells in a tab’ is closed to new replies.