[Resolved] Set different number of columns categories and products woocommerce shop page

Home Forums Support [Resolved] Set different number of columns categories and products woocommerce shop page

Home Forums Support Set different number of columns categories and products woocommerce shop page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1344589
    Edward

    I’m trying to set two columns for product categories and four columns for products, all shown on my Woocommerce shop page. I have searched the web for the solution quite a bit and tried numerous php code snippets. There is another GP support topic from October 2017 – Woocommerce How to have different Columns Layout in Shop and Categories – but the code there does not work for me (I switched out is_product_category() for is_product_category() on the “Changing Number of Columns” code from the link to the support article on this support thread. I hope this can be solved, I’m so grateful for the awesome support here at Generate Press.

    https://docs.generatepress.com/article/using-columns-in-the-blog/#adding-columns-to-your-custom-post-type

    #1344790
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Those filters are for the blog, not your products.

    You can find the product column options in Customize > Layout > WooCommerce.

    If you want to set the columns with a filter, you can do something like this:

    add_filter( 'option_generate_woocommerce_settings', function( $settings ) {
        if ( is_product_category() ) {
            $settings['columns'] = 2;
        }
    
        return $settings;
    } );
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.