Site logo

Archived topic

woocommerce category images / rows

44 replies · Started by sparkle on November 23, 2019

Viewing posts 31–45 of 45

So now it's using the option in Customize > Layout > WooCommerce.

This function should now overwrite that Customizer option:

add_filter( 'option_generate_woocommerce_settings', 'tu_custom_wc_columns' );
function tu_custom_wc_columns( $options ) {
    if ( is_product_category( 'apparel' ) ) {
        $options['columns'] = 6;
    }

    return $options;
}

Can you confirm that it's still added? The account you set up for me doesn't have file editing capabilities so I'm not able to see the theme editor.

Let me know :)

i took everything out but that and it's still not working and we're back to 3 across.

i added the wp-file-manager plugin and turned of the security plugin to give you better access.

Grr, wonder what's happening. I'd like to debug but don't want to crash the file editing system using var_dump. Can you try adding the filter using a plugin like Code Snippets possibly?

hmm. i've never used that plugin, but i activated it and added the snippet. check me, because i'm not sure if i did it right. there's nothing at all in my functions file now.

we're back to four across now tho. lol.

i have no idea what a var_dump is but it's ok to knock the dev site down. i'm not working in it for the next couple days. i don't think if you take it down, it would affect my live site -- but i'm not actually saavy about that. i'm happy to give you whatever access you need.

thanks tom. sorry this is frustrating, tho it is heartening to me when i can't figure something out and then it's also a puzzle for the support folks.

I'm not sure why that filter wasn't working - super strange.

Instead, I tried this:

add_filter( 'generate_woocommerce_container_classes', function( $classes ) {
	if ( is_product_category( 'apparel') ) {
		$classes = array_diff( $classes, [ 'wc-columns-4' ] );
		$classes[] = 'wc-columns-6';
	}
	
	return $classes;
} );

It seems to be working :)

oh. we are SO close.

the goal was to make the subcategories 6 across, but products 3 across. right now they are 6.

https://imgur.com/a/rttIPpU

I'm not seeing a way to do that, unfortunately. All of the categories and products are within the same container, so we can't target them differently.

If you can somehow separate the two, we should be able to.

i was kind of able to get the look i want with elementor, but it's not nearly as nice as your standard woocommerce treatment.

That's a shame. Were you able to find a way to separate the products and categories? If we can get them into their own containers, we have a lot more options.

That looks good. I wonder if it's possible to separate the categories/products if we overwrite their category template? Might be worth looking into if you're not comfortable sticking with the Elementor approach.

i just think yours is prettier out of the box. technically this works and i use elementor heavily on this site. i've not done much with woocommerce templating, at least not very successfully. but i'm willing to try if you have tips.

I looked at their templates and they don't make it very easy, unfortunately. What you have is likely the best method for this kind of layout.

i love that you looked. thank you. :)

No problem! :)

This archived topic is closed to new replies.