How to Customize “In Stock” Text on Woocommerce Products
Have you encountered a situation where you wanted to update the “In Stock” feature on WooCommerce products, but couldn’t find an easy way to do this?
We encountered this request on a client website and needed to create a solution for this issue. The client wanted the “In Stock” feature in WooCommerce to instead be “Spots Left” because of the unique nature of their business products.
In searching for a solution for this request, we had great difficulty finding a good answer online.
Because of that, we would like to share the solution we came up with in hopes that it solves the issue for you if you need to customize in-stock product text in your WooCommerce store.
In this Blog Post, you’ll learn how to customize the “In Stock” text display for a Category.
Customize “In Stock” Text in WooCommerce
Woocommerece allows us to customize the features and functionality of the theme that you are using. This is all possible just by adding a code to the template file on function.php.
When there is a product available, it allows the customer to add the product to their cart and shows the text “In Stock”, but when the item is sold out, it will say Out of Stock. But here we will change the stock text to “Spots Left” for the specific items.
Here are some steps and the code that can help you to make these changes by using Woocommerce.
Step 1: Go to WordPress and navigate to Appearance -> Editor tab and open functions.php file for editing.
Step 2: Add the following code to the bottom of functions.php’ file. This code shows how to change the text ‘In stock’ to ‘In Spot’ text for a product:
:- cats: the product category ID form.
This code is used to make specific changes mentioned above, but this code can help you change the text to anything of your choice.