I changed the color of "Availability: In stock" in green but i want to change the color "Availability: In stock" programmly.
For example
if the quantity of product < 5 i want to color "Availability: In
stock" in red
if the quantity of product > 5 and the quantity of
product < 10, i want to color "Availability: In stock" in orange
if the quantity of product > 5 and the quantity of product <
10, i want to color "Availability: In stock" in green
Best Answer
You can get the available qty like this
But you have to be careful. You can have products where the line above returns 0 but the product is in stock because
Manage stock
is set toNo
.To check this use:
Now combining these 2 you can get the color like this:
[EDIT]
Now change the element that wraps the availability to this:
and add this to your css file
note: This works for simple products.