New year, time for new Ask Sell with WP questions!

Today’s question is from Edin:

How can I remove “in stock” or “out stock” from the children products, please? I have already removed them from the main product, but I haven’t found yet a way to remove the inventory visibility from the children products.

This is an interesting problem, thanks for asking Edin 🙂 Turns out that there’s no setting for this, as WooCommerce variations or child products don’t quite respect your stock settings.

WooCommerce Stock Labels: Default Display

When you set up product inventory settings, you can determine how and when stock is displayed.

WooCommerce Inventory Settings

This will ensure that “In stock” or “Out of stock” are never shown on your product page, nor is the stock level shown above or below the add to cart button.

WooCommerce Simple Product Stock Display

However, variable products will show “In stock” or “Out of stock” for the selected variation above the add to cart button, as they’re not governed by this setting.

WooCommerce Variable Product Stock Display - before

Default display

Let’s start digging to see how stock is output for variations so we can adjust this display.

WooCommerce Stock Labels: Stock Display Functions

First, we need to find out what outputs the stock HTML on the product page. In looking at the product page templates, along with the variable product class itself, we see that the wc_get_stock_html() function is used for products to output the inventory HTML.

Awesome! Let’s take a look at that function in more detail. It turns out that it has a filter around the HTML output: woocommerce_get_stock_html

Let’s try giving that filter an empty string (nothing) to display instead:

add_filter( 'woocommerce_get_stock_html', '__return_empty_string' );

Hmm, so we have a conundrum. If we look at a product page in WooCommerce 2.6, this stock notice is still displayed:

WooCommerce Variable Product Stock Display - before

First attempt

However, if you plan to upgrade to WooCommerce 2.7 right away, this snippet will work in WooCommerce 2.7 automatically as it changes the way the product page is displayed.

Regardless, we want to something that works with the current version of WooCommerce, so let’s try to find an alternative. If we go back to our variable product class, we’ll see that there’s a filter wrapped around all of the data output by a variation, including the stock HTML we referenced earlier: woocommerce_available_variation

Let’s try to use that filter instead, and we’ll completely remove the availability / stock data from the variation data. We can unset the availability_html from the product variations so it’s not there to be output on the product page.

// Remove variation stock data from product page display
function sww_wc_remove_variation_stock_display( $data ) {
    unset( $data['availability_html'] );
    return $data;
add_filter( 'woocommerce_available_variation', 'sww_wc_remove_variation_stock_display', 99 );

See the full code snippet here

Now let’s have a look! That seems to fix the issue in WooCommerce 2.6 and the upcoming 2.7 version as well, as my “In stock” note is now removed:

WooCommerce Variable Product Stock Display - after

Adjusted display

Whoohoo, our WooCommerce stock labels have now been removed. Hope this helps Edin!

Not sure how to implement this? Check out this guide to adding custom code to WordPress.

Remember, if you have your own questions, you can submit them here.

Note: This post may contain affiliate links, which means we get a commission from the plugin, theme, or service provider if you choose to purchase. Regardless of this, we are committed to providing high quality, unbiased resources. Have more questions? See our affiliate policy. You can use the plain links below if you prefer that we not receive a referral commission:

Your WooCommerce store can drive additional revenue by improving your email marketing. Try Jilt for free to increase sales with abandoned cart recovery emails, post-purchase follow-ups, and more!
Articles you may also like:

Posted by Beka Rice

Beka Rice manages the direction of Sell with WP content and writes or edits most of our articles to share her interests in eCommerce. Or she just writes as an excuse to spend more time jamming out to anything from The Clash to Lady Gaga. Who knows.


  1. Great post but could not get it working, I place code in theme functions.php but nothing changes 🙁


  2. Not working for me.
    I found in wp-content\themes\theme-name\woocommers\single-product\meta.php code which is responsible for the output of this inscription(“Availability: In Stock”).
    How to disable this?


  3. I can’t get this to work either. Sorry, it would be really great.


  4. Thanks. Working great for removing stock text for variation products. Using woocommerce 3.0+


  5. Thanks!

    I’m curious if there’s a code to hide the stock status for certain product category only? Say I’m selling several products with several categories but wants to hide the stock status for “Category A” only, how to go about that?



Leave a reply

Your email address will not be published. Required fields are marked *