Show in stock / backordered in Order Confirmation email?

Highlighted
New Member
4 0 0

Hi,

Is it possible to access the stock levels from the order notification email? 

How would you go about seeing if the item was in stock or backordered?

I want to add a line under the item description td tag with whether the item is in stock or not. 

I'm using a 3PL for fulfillment and allow for orders when items are out of stock.

I have a coding background but I'm unfamiliar with liquid and the Shopify variables.

Cheers.

Skye

0 Likes
Highlighted
Excursionist
32 0 7

Hey, you can use the variant.available as an if statement, but since its in an email it would likely be item.available. Here is some information on how that would work:

https://help.shopify.com/en/themes/liquid/objects/variant#variant-available

{% if item.available %}
THIS IS IN STOCK
{% else %}
THIS IS BACKORDERED
{% endif %}

 

 

1 Like
Highlighted
New Member
4 0 0

awesome thanks.

I assume I could check 

item.inventory_quantity > 0

as I'm assuming inventory_policy is set to continue as you can continue to purchase the products with no inventory. 

Cheers.

0 Likes
Highlighted
Excursionist
32 0 7

Yep that works perfectly as well. 

0 Likes
Highlighted
New Member
4 0 0

Ok that doesn't seem to have worked. I don't think line_item has access to stock levels. 

It seems like you need to link it to all_products object but I'm not sure how to do that. 

Any ideas?

0 Likes
Highlighted
Excursionist
32 0 7

if you use lin_item.product or item.product then you can access all of the liquid variables of the items parent product.

 

line_item.product.inventory_quantity

0 Likes
Highlighted
New Member
4 0 0

Ok sweet. I'll try that. Thanks.

0 Likes