Estimated Delivery Time based on stock status

VivHome
Tourist
8 0 1

This is my code I have now:

 

 <div class="in-stock">
              <p>Beschikbaar: <span class="stock">{% if product.available %}Op Voorraad</span>
{% else %}<span class="out-of-stock">Niet op voorraad
{% endif %}</span></p> </div>

The problem with this is as followed:

 

When products hit stocklevel 0 the stock status will change to "Not in stock" IF products are not available to order for customers. 

 

What I need:

 

When products hit stock level 0, the stock status needs to change in something like "Delivered in 1-3 days" but still be available to order for customers. Right now it will show: "In Stock".

 

 

Could anybody help me with how to code this? I have HTML/CSS and PHP knowledge but this is the first time setting up something in Shopify.. 

 

 

 

EDIT:

 

Never mind. With some coding experience it is very easy to add this. For people who are looking for the same feature, this is the code I used:

 

Beschikbaar: <span class="stock">{% if current_variant.inventory_quantity > 0 and current_variant.available %}Op Voorraad</span>
{% elsif current_variant.inventory_quantity == 0 and current_variant.available %}<span class="out-of-stock">Geleverd in 1-3 dagen</span>
{% else %}<span class="out-of-stock">Niet op voorraad</span>{% endif %}
AJ2020-
New Member
1 0 0

Hi,

 

The functionality you are describing is exactly what I want to implement in my website. Can you inform me where to add this code to get this result?  

 

Hope somebody can help me!

0 Likes
Gustav97
New Member
2 0 0

Just go to Onlineshop>Themes>Aktions:Edit code. Then search for product.form.liquid and paste the code to the bottom. 

It gonna be displayed under your ATC at the product details page. Your also can insert it at the place, where you want it to appear. 

0 Likes
Gustav97
New Member
2 0 0

Does this code snippet work for you?

At my shop it displays "not in stock" the whole time. Do you have a solution for that?

 

 

0 Likes