Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1425952

    Hi there,
    i would like to set the colmuns per product category in some product categories.

    In Woocommerce I can only change the global setting, which is then for all product categories on the entire site.

    Is there a way to set the columns only per product category?

    Or is this not possible via the theme and I have to search on Woocommerce?

    Best regards
    Christian

    #1425954

    Hey Chrisxx1982,
    How many columns do you want them to be? If you want them to be 2 columns try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    add_filter('loop_shop_columns', 'loop_columns', 999);
    function loop_columns() {
        return is_product_category(array(34, 35)) ? 2 : 3; 
    }

    and change the category IDs to suit, then add this css:

    .shop_columns_3 .products.columns-2 .product {
        margin: 0 1% 1% 0;
        width: 48.6%;
    }

    If you want them to be 4 try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    add_filter('loop_shop_columns', 'loop_columns', 999);
    function loop_columns() {
        return is_product_category(array(34, 35)) ? 4 : 3; 
    }

    again change the category IDs to suit, then add this css:

    .shop_columns_3 .products.columns-4 .product {
        margin: 0 1% 1% 0;
        width: 23.6%;
    }

    Only use one or the other, not both.

    Best regards,
    Mike

    #1425955

    Hi Mike,

    thanks alot. I’ll try it out and report back if it worked.

    I have never entered PHP code anywhere :) Do you know where I can find it, is it in the theme settings? So also a field similar to quick css?

    I would like to set the colums to 4 in a few product categories. Currently global is set on page 3.

    Best regards
    Christian

    #1425956

    Hi Mike,

    I tried it and it works :) That’s really great that you can do something like that too.

    Thank you very much, that helps me a lot. I first increased the page width and removed the sidebar for some product categories, but then the product boxes at 3 columns are too big. For this reason I now need 4 columns for some product categories.

    Great, I’m very happy about the fast support. You have helped me a lot so far, thank you very much.

    Best regards
    Christian

    #1425972

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Columns in Productcategorys’ is closed to new replies.