WooCommerce Specific Category Columns Change

I have been trying to achieve a one column layout (product on left, price and description on the right) for a specific category (rentals) on our site. But no matter what solutions I try, it won't work.

add_filter('loop_shop_columns', 'loop_columns');
				if (is_product_category('rentals', 20)) {
					function loop_columns() {
						return 1; // 1 products per row

In the above code I am trying to specify is_product_category 'rentals', but it changes across the entire site??
Any ideas?

Thanks for your support!

  • Katya Tsihotska
    • Support & QA

    Hi Luke

    How are you doing?

    Could you please try the following code:

    add_filter('loop_shop_columns', 'custom_loop_columns', 999);
    if (!function_exists('custom_loop_columns')) {
    	function custom_loop_columns() {
    		if ( is_product_category( 'rentals' ) ) {
    			return 1;
    		} else {
    			return 6; // set products per row for all other categories

    Make sure that you don't forget to set default columns value, it set to 6 in the code above. Please let me know how if it works. If no, could you send us your details through our contact form https://premium.wpmudev.org/contact/#i-have-a-different-question , so we can have a closer look how it works on your end? Please, use this template

    Subject: "Attn: Katya Tsihotska"
    -WordPress admin username
    -WordPress admin password
    -login URL
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant URLs

    Please use this subject line to ensure that it gets assigned to me.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.