I want to display a badge when a product is sold out at Woocommerce.
The following is entered in functions.php and css is also entered, but it is not displayed.
Is there any other place to fix?
add_action ('woocommerce_before_shop_loop_item_title', function () {
global $ product;
if (! $ product-> is_in_stock ()) {
echo '<span class = "soldout"> Sold out </ span>';
}
});
We are looking for a solution from everyone.
Thank you.
Without active support, you can expect help with possible bugs only. By Envato rules, we don't need to answer at all on any questions from not supported users, but our rules are more soft, we don't answer only on customization questions. Thank you for understanding