Hi Shawn,
Thanks for reaching out to us. Please try the below snippet and follow the instruction inside the code block:
add_filter('default_woo_variation_swatches_single_product_dropdown_html', function($default){
$target = [14]; //Insert the product id’s inside the target. For Example: [14,45]
if( in_array( get_the_ID(), $target ) ){
return true;
}
return $default;
}, 10, 1);
Thank You
Hide variation swatch when only one
Shawn Ransford
Odd request, but I have several products with only one variation. I’d like to hide the swatch entirely when there is only one available. Any suggestion? I see where I could make the change in the frontend.js, but am hoping you have a snippet or might offer an alternative. Thanks in advance!
Here are two links to my test site with an example…
https://copy.holycityfarms.com/product-category/flower/
https://copy.holycityfarms.com/product/blitzed-dry-sift-puck-4-grams/