Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1188448

    Hi,

    is it possible to specify the number of columns and the product count only for certain product categories or pages?

    thx in advance
    max

    #1189056

    Hey maxisgoinghome,

    If you build custom category pages you’ll be able to specify the columns count.

    Column count in woocommerce category pages

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #1189190
    This reply has been marked as private.
    #1189878

    Hi,

    Thank you for the update.

    You can use this filter to change the number of products per row in the archive or shop page.

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

    Now, if you want to only apply the changes to a specific category, then you have to add conditions inside filter.

    /**
     * Change number or products per row to 3
     */
    add_filter('loop_shop_columns', 'avf_loop_columns', 999, 1);
    if (!function_exists('avf_loop_columns')) {
    	function avf_loop_columns($items) {
                    if(is_tax('product_cat', 'category_name')) {
    		     $items = 3 ; // 3 products per row
                    }
                    return $items;
    	}
    }

    Replace “category_name” with the actual name or slug of the product category.

    Best regards,
    Ismael

    #1189919

    Hi Ismael.
    thx for the message. Where do I put this code? Quick CSS, function.php or anywhere else?
    brg
    max

    #1190319

    Hi,

    You should add the snippet in the functions.php file. And don’t forget to adjust the category name. Let us know if it works.

    Best regards,
    Ismael

    #1190395

    hi ismael,

    thx that worked. problem is that the columns don’t get “resized”. I.e. if there is a standard of 5 columns and I decide to add the snippet with 3 columns there is a lot of white space on the right side ;))

    thx. you can close the topic.

    #1190726

    Hi,

    Thanks for the update, I’ll go ahead and close this thread for now then. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Column and Product Count for Specific Category Pages’ is closed to new replies.