Hi
I am requesting help with a custom order confirmation email update.Here are the requirements:
- Display custom HTML markup based on the product ID of the product purchased. For example, if the ProductID is 111, then displayYou have purchased product 111.
- If the order contains multiple purchases of a product, only display one instance of the HTML markup. In other words, if the order contains two productID 111 items, only show the ProductID 111 markup once.
I have successfully met requirement 1 through the following liquid code:
{% for line in subtotal_line_items %}
{% assign productID = line.product.id %}
{% case productID %}
{% when 111 %}
{% when 222 %}
{% when 333 %}
{% else %}
{% endcase %}
{% endfor %}
So far so good. But I am unable to meet requirement 2.
Specifically, I have added IF statements to only display the markup if it is the first. But this fails; specifically, no custom markup displays.
Here is the code that fails:
{% for line in subtotal_line_items %}
{% assign productID = line.product.id %}
{% case productID %}
{% when 111 %}
{% if productID.first == 111 %}
{% endif %}
{% when 222 %}
{% if productID.first == 222 %}
{% endif %}
{% when 333 %}
{% if productID.first == 333 %}
{% endif %}
{% else %}
{% endcase %}
{% endfor %}
Look forward to your suggestions.
Thanks in advance, and please let me know if you have any questions.