WooCommerce: change the number of Upsell Products


This article describes how to change the number of upsell products within your WooCommerce shop. Upsell products are displayed at the bottom of a product description page under the “You may also like…” section.

General Instructions:

  1. Access Appearance > Editor
  2. Open Theme Functions (functions.php) file
  3. At the end of the file add the following code:
 function woocommerce_upsell_display( $posts_per_page = 4, $columns = 4, $orderby = 'rand' ) { woocommerce_get_template( 'single-product/up-sells.php', array( 'posts_per_page' => $posts_per_page, 'orderby' => $orderby, 'columns' => $columns ) ); } 

Note: By default the Theme shows Products in 2 Columns $posts_per_page = 4 (sets the number of products to display – change as needed) $columns = 4 (sets the number of Columns – change as needed) Important: If your functions.php file has a ?> Tag at the very end, then add the above code before that Tag.

  1. Access the Site Options Panel by clicking on ‘Appearance > Site Options’
  2. Click on the ‘Styling Options’ tab
  3. Scroll down and add the CSS code below into the ‘Custom CSS’ section
 .upsells.products ul.products li.product {width:23% !important;}

(click screenshots for full-size view) [search_terms]upsell, woocommerce, products, you may also like, woocommerce description, related, related products[/search_terms]