skip to Main Content

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


  1. Chosen as BEST ANSWER

    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.


  2. Your issue is probably coming from these lines:

    {% if product.tags contains 'PNMM' and transaction.gateway == 'Bank Transfer' %}
    

    and

    {% elsif product.tags contains 'SVMML' and transaction.gateway == 'Bank Transfer' %}
    

    You are trying to access product.tags, but in the context here, product is going to be a property of line inside your for loop. So you need to be accessing line.product.tags rather than product.tags.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search