0

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.

10
  • This has everything to do with the theme you are using. It is possible. Commented Jan 24, 2016 at 3:52
  • Are you sure because the theme itself is designed around Woo Commerce Commented Jan 24, 2016 at 3:53
  • Yes, the theme is in control, that setting is specific and must be utilized by the theme. Commented 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. Commented 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. Commented Jan 24, 2016 at 5:22

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.