Changing the "in stock qty" to display "Available to order" if quantity reaches 0 or below

I want to make all my products available to order if they are not in stock, I understand that to do this i need to select the continue selling checkbox on each product page.

However, I am currently using a different page template for products that are only available to order so that I can have the products display “Available to order” at the top. Is there a way to have the product display the qty in stock if the stock level is above 0, but if the stock falls to 0, then still allow the customer to purchase, but have some text that appears saying that these are available to order?

I am using the Empire theme

Thank you in advance!

That should be doable with custom coding. Something like this:

{% if variant.inventory_quantity > 0 %}
  

{{ variant.inventory_quantity }} in stock.

{% else %}
  

Available to order!

{% endif %}

Thank you for your quick answer. Sorry to probably ask a really basic question, but where about would I need to put this code?

You’d need to replace the coding in your theme with the code that I shared. If you’re unfamiliar with making coding edits, you’d want to hire a Shopify Partner/Expert to make the changes for you.

You can hire someone from this page (https://www.shopify.com/partners/directory/services/store-setup/customize-theme). I’d also be happy to quote you for this work – you can find my contact details in the signature of this post.