Home » WooCommerce: One Product Per Row @ Shop Page

WooCommerce: One Product Per Row @ Shop Page

by Tutor Aspire

By default, WooCommerce displays 4 products per row in the shop page. This is nice for almost any ecommerce website, however in certain cases you might want to change this setting in order to show full-width products (a.k.a. one product per row).

In this post we’ll look at the alternatives you have in regard to changing this setting, and also some CSS adjustments to make the 1-product-per-row shop page look better. Enjoy!

Our goal: a 1-product per row layout on the Shop page

PHP Snippet: Change Number of Products per Row @ WooCommerce Shop Page

/**
 * @snippet       1 Column Layout @ WooCommerce Shop
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @testedwith    WooCommerce 3.9
 * @donate $9     https://tutoraspire.com
 */

add_filter( 'loop_shop_columns', 'loop_columns', 999 );

function loop_columns() {
   return 1; 
}

CSS Snippet: Centered Layout @ WooCommerce Shop Page

Once you have “1 product per row” in place, you might get a result similar to this (basically, despite you have one product per row, they don’t take full width and therefore the layout doesn’t look right):

Despite we have one product per row, they won’t take full width.

Which means we also need to make use of some CSS in order to move the products and center align them.

/**
 * @snippet       Stretch Products to Full Width @ WooCommerce Shop
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @testedwith    WooCommerce 3.9
 * @donate $9     https://tutoraspire.com
 */

ul.products li.product .woocommerce-loop-product__link {
    margin: 0 auto;
}

ul.products li.product .button {
    margin: 0 auto;
}

The final result is shown at the top of this page.

If you also want to change the dimensions of your product images, go to WordPress Dashboard > Appearance > Customize > WooCommerce > Product Images and make sure the width of your Catalog images is at least 1000px.

You may also like