Number and Columns of Upsell Products
Controls how many "You may also like" upsell products appear on product pages and in how many columns.
Opens WPIDE on
Code
add_filter( 'woocommerce_upsell_display_args', function ( $args ) {
$args['posts_per_page'] = 3; // How many upsells to show.
$args['columns'] = 3; // Columns.
return $args;
} );
Notes
Set $limit to 0 to show all upsells.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.