Hiding unavailable product variants | WordPress.org

Hello @dad0 by default all variants that are out of stock should be greyed out. Your theme seems to be custom and not something we support here.

I did however find a hook that may help you, but again we don’t really support customization here.

Thread Starter


It is not indicated where the code you suggested should be inserted.

@dad0 they didn’t say? Wow, sorry about that. That’s not very nice of him. Any hook like this would go in the functions.php file of your Child Theme towards the bottom is the best place for it, click save, clear server and browser cache, then refresh that page.

Do not place this into a Parent theme as it will get overwritten on update.

Hi @dad0

I would like to ensure that unavailable product variants are not displayed in the selection menu at all, or at least that they are disabled. How can I do this?

Have you had a chance to try this setting in WooCommerce → Settings → Products → Inventory → Out of stock visibility → check “Hide out of stock items from the catalog”?

Kindly let us know.



This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer