I am creating custom code for my client who wants to allow backorders in case the quantity of the stock drops below 1.
I noticed some weird behaviour in case I check the “continue selling when out of stock” option.
My first issue is that Shopify automatically:
- Disables the button. (which is opposite from the idea)
- Adds “Sold Out” label to the button. (you can change the text of sold out in “language settings” but that doesnt solve the previous issue..)
I found a lot of topics around backorders here but none really offered a straightforward solution from a developers point of view.
I find it hard to believe this simple features are simple implemented backwards in Shopify.
My inelegant solution for this here below.
My Code:
{% if current_variant.inventory_quantity > 0 %}
{% else %}
Available On Backorder
{% endif %}
Hope this helps someone who has the same issue and doesn’t want to lose time.