How to Remove WooCommerce Stock Messages

How to Remove WooCommerce Stock Messages

WooCommerce has pretty decent inventory control capabilities baked right into the base plugin. You can turn these on for each product in your store using the “Inventory” tab of the Product editing screen inside of the WordPress admin.

Manage Stock in WooCommerce
You can manage stock from the WooCommerce Product admin

There are all sorts of useful things possible with this tab. Set the amount of a product you currently have in stock. Decide whether or not to allow an out-of-stock product to be back-ordered. Or even tell WooCommerce to email you directly when a stock amount on an item reaches a certain level.

Stock Message in WooCommerce
An example of a Stock Message in WooCommerce

One of the default settings, once you’ve checked the “Manage stock?” box on a product, is to add stock messages to each product’s page on your store.

This is a really useful way to inform potential customers how many of the item they are interested in is available but you don’t always want to broadcast to the public your inventory levels.

If you want to remove these stock messages from your store you’re going to have to make some changes to your WordPress theme or purchase our plugin and save yourself the trouble of editing any code and messing up your site beyond your capabilities to fix.


How to Hide WooCommerce Stock Messages with Code

You can get rid of stock messages on your products with some code-related changes to your WordPress theme. We’ll walk you through what’s involved to get your site layout changed.

Alert! Before you get started please make a complete backup of your WooCommerce store. This includes the site’s theme and its database as well (just to be safe). If anything goes wrong with your code changes you are going to need to be able to revert back to how things were to keep your site up and running.

Create a Child Theme

We’re going to get started by making a child theme. In WordPress terms, a child theme inherits the features of its parent theme but allows you to still make modifications safely. The reason you do things this way is to prevent your changes from being lost. When you edit a parent theme directly your changes are lost during the next theme update. With a child theme, your changes will persist throughout any parent theme updates in the future.

You can learn how to build a child theme yourself using this great tutorial at Smashing Magazine. Once you have your theme made it is time to bust out a text editor and write some code.

Add Code to the Child Theme

Every WordPress theme has a file called functions.php and your child theme should be no different. Create the file and open it up in a text editor. Then add the following lines of code to the file and save it.

add_filter( 'woocommerce_get_stock_html', 'my_remove_stock_messages', 10, 2 );
function my_remove_stock_messages( $html, $product ) {	 
    return '';	 	 
}

This chunk of code will remove the stock message from every product on your site. This is a global change. You can write code that will only remove stock messages from certain products or categories. Unfortunately, that’s much more involved. You should consult the WooCommerce documentation to learn more.

You’re about halfway through. Save your functions.php file before going any further. The next step is probably the most alien to non-technical people so be warned.

Upload the Child Theme

There are two ways to take your finished child theme and upload it to your server. You can use something called FTP. This requires a separate application and connection details provided by your host. If you have trouble with this your hosting provider’s support staff might be able to help.

You can also upload a WordPress theme from within the admin itself. Go to the Appearance section of the admin menu. Under Themes you will find an “Add New” button that will lead you to upload your theme. Make sure the theme is in a compressed .zip file first.

Too technical for you? It’s possible to remove stock messages from your WooCommerce site without all of this child theme making and code writing. Take a look at our simple plugin for a quick, simpler, and better way to remove stock messages.

Activate the Child Theme

This is the final step. After you have successfully uploaded your child theme it should appear under the Appearance tab. Activate the theme and, if all has gone well, the stock messages should have vanished from your WooCommerce site.

If the stock messages are still there or your site has totally collapsed with errors you need to deactivate the child theme. There is most likely an issue with the upload or the code changes you made in the functions.php file. Try and figure out the issue, save the corrections, and then upload again.

Eventually, you will get it all right and your site will be functioning how you want it. Congratulations! You’re now something of a WordPress developer.

Stock Message Removed from WooCommerce
An example of the stock message removed in WooCommerce

Of course, this can all be done in a much simpler and faster way using our plugin. You can certainly save yourself time using our plugin instead of doing all of this work yourself.


Remove WooCommerce Stock Messages the Easy Way

We have made a very simple plugin that lets you remove WooCommerce stock messages from the product pages on your site. The plugin has some additional features that make it far more useful than the code snippet we discussed above.

You can use our plugin to remove stock messages from:

  • All Products
  • Products in Specific Categories
  • Specific Products

Purchasing and installing our plugin takes a few minutes. There is no code to write or learn about. You won’t have to make and upload a child theme. Our plugin makes this process short and stress-free. We even have you covered if you’ve never dealt with purchasing a plugin before. You’ll be emailed step-by-step instructions to install and activate the plugin.

After installation, you’ll see a Remove Features tab in your WooCommerce settings screen. This is where you can control exactly which products or categories have stock messages removed.

Screenshot of RWF Stock Messages Plugin's Settings

It’s as simple as that. Our plugin gives you total control over the display of stock messages on your WooCommerce store. All you need to do is check a box or type in the names of some products and categories.

When you purchase our plugin you get:

  • 90 days of support. Get help with your plugin up to three months after purchase.
  • No license keys or yearly subscriptions. Pay $9 once.
  • Unlimited installations. Install the plugin on as many sites as you want.

We offer a 14-day money-back guarantee. Get a full refund if you are unhappy with our plugin or if it doesn’t meet your expectations.