That’s a great idea, thanks..
Basically, this code changes the color of the stock availibility status text
.single-product-top-1 .product_meta-area .product-meta-content {
color: red;
}
But using this, all availability text changes to red… If you use the postid code you shared above, you can change the color for individual products but you have to manually set the color for each product…
But the specific question is how to directly link the color to the stock availability.. when the stock drops to 0, the ‘out of stock’ text should automatically become red, when the stock is available the ‘in stock’ text should automatically be green.
Is there a code that can achieve the same?
Also, in functions.php there is this code.. which controls the text: can it be edited to change the color?
public static function get_stock_status() {
global $product;
return $product->is_in_stock() ? esc_html__( ‘In Stock’, ‘metro’ ) : esc_html__( ‘Out of Stock’, ‘metro’ );
}
-
This reply was modified 3 years, 12 months ago by
pbadam.