Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WooCommerce - Change number of displayed upsells on product pages
add_filter( 'woocommerce_upsell_display_args', 'custom_woocommerce_upsell_display_args' );
function custom_woocommerce_upsell_display_args( $args ) {
$args['posts_per_page'] = 5; // Change this number
$args['columns'] = 5; // This is the number shown per row.
return $args;
}
@baggiesmad

This comment has been minimized.

Copy link

@baggiesmad baggiesmad commented Apr 11, 2018

Does this work with the most recent release of Woocom?

@acal

This comment has been minimized.

Copy link

@acal acal commented Oct 9, 2018

Does this work with the most recent release of Woocom?

This worked for me on Woo 3.4.5. Thanks Mike!

@StefsterNYC

This comment has been minimized.

Copy link

@StefsterNYC StefsterNYC commented Apr 25, 2021

Mike, I'm trying to change the Cross Sell display. I can't hook it and I can't find anything anywhere that can make this happen.

I've tried yours above by changing the filter to cross_sells and I've tried

 `
     add_filter( 'woocommerce_cross_sells_total', 'shopkeeper_change_cross_sells_product_no' );
             function shopkeeper_change_cross_sells_product_no( $columns ) {
       return 6;
    }
`

Nothing has worked. What am I missing? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment