fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Swatches no longuer being hidden or crossed when unavailable

Alexe Emond

Hi there,

As of most recent updates, the functionality to hide a swatche when it’s not available with current variation selected on the page is NO LONGER WORKING.

You can test here : https://spherikbike.com/en/product/e-srg-electric-road-bike/

The chameleon color (green/purple) is not available with the APEX MEC option. So color should disappear when selected (as it was before).

I tried selecting a new option (crossed/ blur) etc. but now working. I cleared transients and cache, etc.

Please get back to us.

 

Thank you

 

 

Alexe Emond

I seem to have had a breakthrough with this.

I modified the number of variations “Detected” as such :

add_filter(‘woocommerce_ajax_variation_threshold’, ‘increase_variation_threshold’, 10, 2);
function increase_variation_threshold($threshold, $product) {
return 150; // Set the threshold higher than the number of variations.
}

And it looks like it did it. Make sense for you ?

Hakik Zaman

Hi Alexe,

Thanks for reaching out to us.

Glad to know you found a solution.

And it looks like it did it. Make sense for you ?

Yes, it is the solution, you don’t have to take any other action regarding this.

Note: It is recommended to add the Custom Code to the child theme’s functions.php file, to avoid any data loss while updating the Parent Theme.

Please let me know if you have any other queries.

Hope to hear from you soon.

Thank You