How to change the badge on the product "in stock" instead of "Sold out" (Woocommerce)?

Good day!
Tell me, please, to the beginner. How to fix the code in bold so that the badge appeared on the goods, which on the contrary is available (i.e. 1 unit). At the moment, this badge appears on the items that are not available. It seems that the condition "in stock" (available), and the function now works on the contrary. Don't know how to fix it. Here's how it looks now on the website the badge "Sold out":
5af97136053f9900000162.jpeg

Here are some of the code that needs to be corrected, to display a different badge for the condition if there are more than 1 unit of 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!
June 5th 19 at 22:12

Find more questions by tags WooCommerce