Support » Theme: Storefront » Need help with storefront – want 2 product columns but only 1 column on mobile

  • Hello.

    I hope someone can help me because I am going mad. I have storefront theme installed. I want to display 2 columns of products, not the default 3. If I use the following code, it takes away the third column but the columns are still 33%, I want them to be 50%.

    function loop_columns() {
    return 2; // 2 products per row
    add_filter(‘loop_shop_columns’, ‘loop_columns’, 999);

    If I mess around with css I can fix that but then it cocks up viewing on mobile devices. I am not au fait with mobile css so I don’t know how to fix that. Also, it seems like a lot of work when…

    …here is why I am going mad… When I check out the source code on a product category page, I notice the code below and if I change the “columns-3” to a “columns-2″, it displays the products exactly how I want them, and it does not mess up mobile view. Can anyone please tell me where the hell this code is located so I can change the three to a two?

    <div id=”primary” class=”content-area”>
    <main id=”main” class=”site-main” role=”main”>
    <header class=”woocommerce-products-header”><header/>
    <div class=”storefront-sorting”></div>
    <div class=”columns-3″>
    <ul class=”products”>

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    You can read this link thread:

    You can put that code (from James Koster) from the link above to your style.css file, however better to put on your child theme other than your theme. It works for my site on mobile!

    Hello. Thank you for replying. I think I was unclear in what I am trying to do. I want to display 2 columns of products on a desktop but only one column of products on mobile devices. If I use css to set the thumbnails to 50% on desktop it affects the mobile view as well.

    If I could find this line of code: <div class=”columns-3″>
    and change that 3 to a 2, it all works exactly how I want.

    Add this to your functions.php in your child theme:

    if ( ! function_exists( 'storefront_loop_columns' ) ) {
    	 * Default loop columns on product archives
    	 * @return integer products per row
    	 * @since  1.0.0
    	function storefront_loop_columns() {
    		return apply_filters( 'storefront_loop_columns', 2 ); // 2 products per row
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need help with storefront – want 2 product columns but only 1 column on mobile’ is closed to new replies.