I’ve been editing the code of the order confirmation on my Shopify store, my target is that if a customer orders a product with "this" tag and the transaction type is "Bank Transfer" then it will show "this" text. I’ve been trying to edit it but the code doesn’t reflect on the email notification of the user. Can anyone have an Idea about this?
My Code looks like this:
{% assign found_pnmm = false %}
{% assign found_svmml = false %}
{% for line in subtotal_line_items %}
{% if product.tags contains 'PNMM' and transaction.gateway == 'Bank Transfer' %}
{% assign found_pnmm = true %}
{% elsif product.tags contains 'SVMML' and transaction.gateway == 'Bank Transfer' %}
{% assign found_svmml = true %}
{% endif %}
{% endfor %}
{% if found_pnmm %}
<p><strong>show this</strong></p>
{% elsif found_svmml %}
<p><strong>show that</strong></p>
{% endif %}
2
Answers
Upon doing some tests, Shopify can't capture 2 values at the same time which are tags and payment gateway. I just did create a collection and call the spill once the product inside the collection is called.
Your issue is probably coming from these lines:
and
You are trying to access
product.tags
, but in the context here,product
is going to be a property ofline
inside your for loop. So you need to be accessingline.product.tags
rather thanproduct.tags
.