This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

CloudwaysCDN — a powerful solution that offers superior performance and satisfied global audience for your business. Read More

Add WooCommerce Sold Out Badge to the Store

Updated on  7th February

2 Min Read
Reading Time: 2 minutes

WooCommerce Sold Out badge often presents a problem to the developers. The problem becomes a challenge when the store has several variations of a product.

WooCommerce Sold Out Badge

In many cases, the variations are sold at different rates. Here is an image from a sample WooCommerce that demonstrate the problem of variation of products on sale:

Products on Sale

Add WooCommerce Sold Out Badge Storewide

The most common scenario is the placement of the WooCommerce Sold Out badge across the store for all the products that have been sold out. This can be accomplished by placing the following code snippet in the functions.php file of the theme.

Here is how the code would look like in action:

Now Sold

Add WooCommerce Sold Out Badge for a Single Product

The next scenario is when you need to place the badge for a single product. For this, place the following code snippet in functions.php file of the theme. This will place the badge in front of the product summary:

This is how the code snippet will place the badge on the product summary page:

 product summary page

Place the following CSS code in the style.css file (located in the theme folder):

An Alternative Method

There is another method of adding the badge. Just add the following code to functions.php of the theme:

Conclusion

In this short tutorial, I demonstrated how you could easily add a WooCommerce store Sold Out badge to the products’ summary. If you need help, just ask the question in the comments below.

Share your opinion in the comment section. COMMENT NOW

Owais Alam

is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform and a seasoned PHP developer. He loves to develop all sorts of websites on WordPress and is in love with WooCommerce in particular. You can email him at owais.alam@cloudways.com

Start Growing with Cloudways Today.

Our Clients Love us because we never compromise on these

Get Our Newsletter
Be the first to get the latest updates and tutorials.

THERE’S MORE TO READ.