How can I mark sold out items as 'presale' on customer order confirmations?

Hey, I am trying to add the line (Presale) to all the sold out itemlines on an order, how can I go about doing that? Our customers regularly miss the text on the website, but they are much better at reading their order confirmations, so I figured marking sold out products there would be helpful.

There’s a for-loop that lists all the subtotal_line_items in the order, their quantity and variant if there is one. I tried adding code there to check if the line in question was < 0 on available and add the message, but nothing I tried worked out. What’s the proper solution for this? Thanks for any help on the matter.

Hi @Deathmel0n

To mark sold-out items in your order confirmation, you need to check the variant’s inventory quantity directly within the line item loop. Since the order has already been placed by the time the email is sent, the stock level for that item will have already been deducted. If the item was at zero and you allow overselling, the inventory quantity will now be zero or a negative number.

Inside your for-loop for line_items, you should add a conditional check next to the product title. You can use code like this:

{% if line.variant.inventory_management == 'shopify' and line.variant.inventory_quantity <= 0 %} (Presale) {% endif %}

Hope this helps!