WooCommerce-Logo

Change the Number of Woocommerce Related Products

Customizing Woocommerce related products output is very easy, paste the following code to functions.php file

Example 1. Display 4 products in 2 columns

// Customize Woocommerce Related Products Output
 function woocommerce_output_related_products() {
 woocommerce_related_products(4,2);       // Display 4 products in 2 columns
 }


Woocommerce Related Products 4 in 2 columns

Example 2. Display 4 products in 4 columns

// Customize Woocommerce Related Products Output
function woocommerce_output_related_products() {
woocommerce_related_products(4,4);   // Display 4 products in 4 columns
}

Woocommerce Related Products 4 in 4 columns

  7Comments

  1. OSIEL   •  

    The second parameters is a number of rows not columns

    • OSIEL   •  

      Sorry, is the number of elements by row

  2. John   •  

    It worked for me, thanks!

  3. Umar   •  

    We need to get :functions.php from Plug-in editor or appearance editor? please help me..

  4. Elvin   •  

    Hi,

    Is there any way to display related product orderby random?

    Regards,
    Elvin

  5. Mohamed   •  

    Thank you so much.

Leave a Reply

Your email address will not be published. Required fields are marked *