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

This entry was posted in WordPress. Bookmark the permalink.

7 Responses to Change the Number of Woocommerce Related Products

  1. OSIEL says:

    The second parameters is a number of rows not columns

  2. John says:

    It worked for me, thanks!

  3. Umar says:

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

  4. Elvin says:

    Hi,

    Is there any way to display related product orderby random?

    Regards,
    Elvin

  5. Mohamed says:

    Thank you so much.

Leave a Reply

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