Skip to content

Instantly share code, notes, and snippets.

@mikejolley
Created May 6, 2016 10:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mikejolley/7a36bfdc40cc210e684d5827907c2ae7 to your computer and use it in GitHub Desktop.
Save mikejolley/7a36bfdc40cc210e684d5827907c2ae7 to your computer and use it in GitHub Desktop.
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;
}
@StefsterNYC
Copy link

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