Answer the question
In order to leave comments, you need to log in
How to change the badge on the product "In stock" instead of "Sold out" (Woocommerce)?
Good afternoon!
Please tell a newbie. How to fix the code in bold so that the badge appears on products that, on the contrary, are in stock (i.e. from 1 pc.). This badge currently appears on items that are out of stock. It seems to be according to the "in stock" condition (in stock), but the function, on the contrary, is working now. I don't know how to fix it. Here's what the "Sold out" badge looks like on the site now:
Here is the part of the code that needs to be fixed to display a different badge by condition if more than 1 unit is available. product:
if (!$product->is_in_stock()) {
$badge = sprintf('%s', esc_html__('Sold out', 'delphinus'));
} elseif ($product->is_on_sale()) {
$badge = apply_filters('woocommerce_sale_flash', '' . esc_html__('Sale!', 'delphinus') . '', $post, $product);
Thank you in advance!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question