• Woocommerce 3.0 Single product Thumbnail columns filter does not work

    This does not work anymore https://hookr.io/filters/woocommerce_product_thumbnails_columns/

    even in the default wp theme 20-16 the thumbnail columns dont change to the correct number. They always stay at 4 whereas the class name of the wrapper changes to the correct number set.

    Pls fix !

    // remove the filter?
    remove_filter( 'woocommerce_product_thumbnails_columns', 'filter_woocommerce_product_thumbnails_columns', 10, 1 ); 
    
    function filter_woocommerce_product_thumbnails_columns($int){
    	$int=3;
    	return $int;
    }
    
    // add the filter?
    add_filter( 'woocommerce_product_thumbnails_columns', 'filter_woocommerce_product_thumbnails_columns', 10, 1 );
Viewing 6 replies - 1 through 6 (of 6 total)
  • woocommerce_product_thumbnails_columns is not available anymore (at least not using in product-thumbnails.php anymore). You should look for alternative ways to accomplish what you are trying to do. You can use the “single-product/product-thumbnails.php” in your own theme by putting that file in a woocommerce folder in your theme root.

    Thread Starter BackuPs

    (@backups)

    That does not get me the columns back…. i have been there. It will only work when i revert back to the old product-thumbnails.php which adds the columns but then i loose the zoom ability.

    this realy ……. what woo is doing here !

    There should be at least some way to determine and control the columns for the thumbs. Why is there other wise the filter in the product-image.php and why does it set the classname to the outer wrapper? I believe they made a mistake in woo v 3.0

    Even the old column css for the thumbnails.php is still in the global woo layout css.

    Your answer does not help or make sense.

    here is the code from the product-image.php

    $columns = apply_filters( 'woocommerce_product_thumbnails_columns', 4 );

    Then why is this there if it does not work anymore? Does not make sense !

    Plugin Contributor Mike Jolley

    (@mikejolley)

    This sets a classname on the gallery. It’s still down to the CSS in the theme to apply the styles and resize the images.

    Thread Starter BackuPs

    (@backups)

    I mentioned already in my initial thread that it only sets the classname to the wrapper. This worked out of the box in v 2.6.14. Why does woo strip abilities? Does not make any sense to have such small thumbnails in a row below the image.

    Why is the classname set when it does not do anything? Then i could have easily added the classname myself.

    It really is bizar what Woo is doing here. Stripping out abilities we had before.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    This is a new gallery from scratch so maybe it was left out, but, core only uses 4 so it makes sense to style 4. If you increase it you can add CSS such as:

    
    .woocommerce-product-gallery--columns-5 .flex-control-thumbs li {
    		width: 20%;
    }
    

    Just change the width % and the columns value.

    I must say, I agree with BackuPs, a pretty strange change made there in v3.0 on the thumbnail gallery.

    Mike, your recommendation won’t work because the thumbs are not actually in LI’s, they are just stacked divs.

    The following CSS worked for me (for a 5 column example):

    .woocommerce div.product div.images .woocommerce-product-gallery__image:nth-child(n+2) {
    	width: 20%;
    }

    The “woocommerce_product_thumbnails_columns” filter does in fact only set the wrapper and seems useless and deprecated now. Maybe updating the documentation would be a good idea and enough to consider this solved.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘V 3.0 Single product Thumbnail columns filter does not work’ is closed to new replies.