Display message when "Continue selling when out of stock" is checked and inventory is <= 0

jnlong
New Member
6 0 0

I'm trying to display a message on my product page that says, "Available on backorder" for items that have "Continue selling when out of stock" is checked in admin, and inventory is equal to or less than 0. I'm using the Debut theme.

 

0 Likes
jnlong
New Member
6 0 0

I got it to work by adding the following code to the product-template.liquid file:

<div class="productStatus">
   {% if current_variant.available and current_variant.inventory_quantity > 0 %}
      <span class="statusAvailable">Available</span>
   {% endif %}
   {% if current_variant.available and current_variant.inventory_quantity <= 0 %}
      <span class="statusBackorder">Available on backorder. Please allow 2-3 weeks for delivery</span>
   {% endif %}
</div>

 

0 Likes
Jasperfoller
New Member
9 0 0

hey in what part of the code did you enter this in.

 

0 Likes
kfurn
New Member
1 0 0

Where did you enter this in the code?

0 Likes
jnlong
New Member
6 0 0

You can enter this code wherever you want it to display on your product page. I placed it just below the product name as shown here. 

product-page-example.pngcode-screen-shot.png

0 Likes
CodeLogic21
New Member
1 0 0
<div class="productStatus">
   {% if current_variant.available and current_variant.inventory_quantity > 0 %}
      <span class="statusAvailable">Available</span>
   {% endif %}
   {% if current_variant.available and current_variant.inventory_quantity <= 0 %}
      <span class="statusBackorder">Available on backorder. Please allow 2-3 weeks for delivery</span>
   {% endif %}
</div>

it works with products which dont have variants. For variants products it do not update the text
0 Likes