Hi
I was able to figure out how to add an out of stock - when due back in message to the product page when still selling by using the inventory transfer.
However the code below doesnt seem to work on the cart page. I would love to remind the customer the expect date for new stock at the cart stage incase they have added other items to the cart that are in stock. I assume the cart isn’t able to pull the inventory as written below. Can anybody help to set this up on the cart page please?
{% assign out_of_stock = false %}
{% for variant in product.variants %}
{% if variant.inventory_quantity == 0 %}
{% assign out_of_stock = true %}
{% endif %}
{% endfor %}
{% assign variant_incoming = false %}
{% for variant in product.variants %}
{% if variant.incoming == true %}
{% assign variant_incoming = true %}
{% assign variant_incoming_date = variant.next_incoming_date | date: "%a, %b %d, %Y" %}
{% endif %}
{% endfor %}
{% if out_of_stock == true and variant_incoming == true %}
Currently Out-of-stock. Expected restock {{ variant_incoming_date }} subject to change
{% endif %}
Thanks
Hi @justdavenow ,
Please follow the steps:
- Step 1: Please change code:
{% assign out_of_stock = false %}
{% if item.variant.inventory_quantity == 0 %}
{% assign out_of_stock = true %}
{% endif %}
{% assign variant_incoming = false %}
{% if item.variant.incoming == true %}
{% assign variant_incoming = true %}
{% assign variant_incoming_date = item.variant.next_incoming_date | date: "%a, %b %d, %Y" %}
{% endif %}
{% if out_of_stock == true and variant_incoming == true %}
Currently Out-of-stock. Expected restock {{ variant_incoming_date }} subject to change
{% endif %}
- Step 2: Add it inside the ‘for cart.items’ of the cart page:
Hope it helps!
Amazing thank you very much are updating the code for cart page.
I figured out it was to do with adding item but not idea how to organise it so thank you very much.
1 Like