Learn how to create labels/badges based on product quantity data.
In this article we will learn how to create WooCommerce product labels and badges based on product quantity data. With such labels you can notify users about the exact value of current product quantity, remind users when a product is almost sold out, or highlight new arrivals.
Examples:
Show quantity data inside a product label.

Label with quantity data inside

Label with 'Almost sold out' text

Label with 'New Arrivals' text
We can create such a label with the help of plugin built-in tools like text variables and display conditions.

Label with quantity data inside
Now let’s look at how to create a label that displays the current product quantity value.
Stock Status - equal to - In Stock
Display conditions for label with quantity value
Only {QTY} left
Label text option for label with quantity value
This will show a label with custom text and the quantity value in place of the {QTY} text variable. You can change that text to any other depending on your needs.

Show label based on product quantity value
Now let’s see how to create labels and badges that appear depending on product quantity values. For example – they will only be visible for products with quantity value less or equal to 10.
Product quantity - less or equal to - 10
Display conditions for label that shown based on quantity value
Almost sold out!
Label text option for label that shown based on quantity value
Use the {QTY} text variable in your label text. For example, set the Label text to Only {QTY} left, and ensure your display conditions include products with Stock Status equal to In Stock.
Yes. After setting your label conditions and text, you can adjust styles, animations, links, and positions under the badge options. These settings let you match labels to your store’s design.
Create separate labels with different display conditions. For instance, one label for products with quantity less or equal to 10 ( Almost sold out ) and another for products with quantity greater than 50 ( New arrivals ). Adjust each label’s text and conditions accordingly.