Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter coolcoder

    (@coolcoder)

    Forgot to mention. I’ve read this.

    https://coenjacobs.me/changing-number-columns-woocommerce-2-1/

    #1 and #2 passed so followed #3 ??

    Thread Starter coolcoder

    (@coolcoder)

    Edit

    Try this in your custom css:

    .woocommerce ul.products li.product,
    .woocommerce-page ul.products li.product
    {width:30%}

    The 30% figure may will need some tweaking.

    If this doesn’t work, please post the url to the page so the markup can be examined with browser tools.

    Thread Starter coolcoder

    (@coolcoder)

    Thanks for reply @lorro.

    It does work when I tweak css manually for product li as per the columns I need. But does not go well except that.

    Actually woocommerce page is supposed to take class columns-2 or columns-3 dynamically as per the columns specified with shop column snippet. Woocommerce has CSS ready for that.

    .woocommerce-page.columns-1 ul.products li.product, .woocommerce.columns-1 ul.products li.product {
    	width:100%;
    	margin-right:0
    }
    .woocommerce-page.columns-2 ul.products li.product, .woocommerce.columns-2 ul.products li.product {
    	width:48%
    }
    .woocommerce-page.columns-3 ul.products li.product, .woocommerce.columns-3 ul.products li.product {
    	width:30.75%
    }
    .woocommerce-page.columns-5 ul.products li.product, .woocommerce.columns-5 ul.products li.product {
    	width:16.95%
    }
    .woocommerce-page.columns-6 ul.products li.product, .woocommerce.columns-6 ul.products li.product {
    	width:13.5%
    }

    Sorry no link currently, but similar behavior can be replicated with TwentyFourteen.

    I was looking into this issue as well. i used the functions.php to override the default columns/products per row. It’s strange that i have to manually add a CSS override when woocommerce has CSS ready for that. I did find that if you use a display shortcode in a page that it does apply the correect CSS.
    [product_categories number="12" columns="3" parent="0"]

    if i use the shortcode the html looks like this
    <div class="woocommerce columns-2">...</div>

    as opposed if i use the functions.php to override, it looks like this
    <ul class="products">...</div>

    I guess overall it’s no huge deal since you can just override the CSS in my childtheme.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Changing number of products per row do not change product li width’ is closed to new replies.