Hello @alecody
Hi alecody (@alecody
You can show the stock graphically by overriding the woocommerce stock template into the active theme. After then upload your images to the folder or else upload from the admin panel in media and copy the image or graphics path. Follow the below steps to the overriding stock template.
1. Go to wp-content/plugins/woocommerce/templates/single-product and copy stock.php
2. Now go to wp-content/themes/{YOUR_ACTIVE_THEME}/woocommerce/single-product/ and paste stock.php here.
3. Enable stock from the product: https://prnt.sc/EXvfnD5wZ9s4
If you didn’t override any woocommerce template in the active theme then please create a directory as mentioned in the above path in the active theme.
In stock.php file, you can set your conditions like,
<?php
global $product;
$stock = $product->get_stock_quantity();
if($stock > 15){
?>
<img src="{IMG_PATH_GREEN}"/>
<?php
}else if($stock > 2 && $stock < 15){
?>
<img src="{IMG_PATH_YELLOW}"/>
<?php
}
}else if($stock > 2){
?>
<img src="{IMG_PATH_RED}"/>
<?php
}
?>
You can put the above code in stock.php or other places you want to show on the product page.
Thank You.
@webdesksolution you are an angel!
I will try what you recommended and let you know.
Most kind!
Ale