0

I have a problem with my shop columns in WooCommerce.

I would like to display 4 columns in my shop but unfortunately there is just 3 columns.

I use the Storefront theme for my shop, so I have looked the storefront-template-fonction.php file and the different apply_filters are setting up on 'columns'=>4.

Exemple:

$args = apply_filters( ‘storefront_popular_products_args’, array(
‘limit’   => 4,
‘columns’ => 4,
‘title’   => __( ‘Fan Favorites’, ‘storefront’ ),
) );

The only "solution" I have found is to used the shortcode [recent_products per_page="12" columns="4"].

But with that, I have another problem, I have the 4 columns that I wanted with my products but the 3 previous columns displayed below too.

I work in Local with an Uwamp server and the last update of WordPress, Storefront and WooCommerce.

I hope there is somebody who can help me.

1

Use this in functions.php file. It is better to create site specific plugins.

add_filter( 'storefront_loop_columns', 'sf_columns_per_row' );
function sf_columns_per_row() {
    return 4;
}
  • Hello, I've tried your code but unfortunately I have no difference. Any others ideas ? – Davalexz28 Jun 20 '17 at 14:25
  • Hello, I had an update this afternoon and your code resolve my problem finally. Thanks a lot for your help. – Davalexz28 Jun 20 '17 at 20:05
0

Use this in functions.php file.

// Change number or products per row to 3
add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
    function loop_columns() {
        return 3; // 3 products per row
    }
}

or use the WooCommerce shortcodes on your archive page:

[recent_products per_page="12" columns="5"]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.