I use Woo Commerce on my site with multiple variations on one product. How do I remove or blank out a variation from being selected if I make the product 'Out of Stock'? I've tried using 'Hide Out of Stock' in the Woo Commerce settings though this made no difference.
-
This has everything to do with the theme you are using. It is possible.– Nathan PowellCommented Jan 24, 2016 at 3:52
-
Are you sure because the theme itself is designed around Woo Commerce– user2634611Commented Jan 24, 2016 at 3:53
-
Yes, the theme is in control, that setting is specific and must be utilized by the theme.– Nathan PowellCommented Jan 24, 2016 at 3:55
-
This is totally false! A theme has no more control over how your site works than a plugin does.There MAY exists a theme that controls this, but you shouldn't go searching through your themes documentation for the answer. Most Wordpress themes are 100% compatible with Woo, and at the same time have 100% nothing to do with Woo.– Jim MaguireCommented Jan 24, 2016 at 4:25
-
@JimMaguire, it has no code which is usually an indication of no research being done before asking it and on top of it, it is asking about off topic subject.– Mark KaplunCommented Jan 24, 2016 at 5:22
|
Show 5 more comments
1 Answer
Managed to solve my own issue.
Simply paste the following into functions.php
function custom_wc_ajax_variation_threshold( $qty, $product ) {
return 10;
}
add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 10, 2 );
Then change the 'return 10;' to however many variations you have.
Please note this may slow down page loading time depending on your hosting.