お世話になります。
コーディングについて初心者となります。初歩的な質問かもしれません。
テーマはDawnを使用しております。
商品と決済方法に合わせて何パターンかのメールの文面を振り分けたいと考えております。
たとえば、商品A・B・Cと3種類ありましたら計6種類のメールの文面を振り分けたいと考えております。
1.商品Aのクレジットカード決済
2.商品Aの銀行決済
3.商品Bのクレジットカード決済
4.商品Bの銀行決済
5.商品Cのクレジットカード決済
6.商品Cの銀行決済
現状、以下のようなコードを書いたのですが、うまく振り分けができておりません。
{% for line in subtotal_line_items %}
{% if line.title contains '商品A' %}
{% assign has_item_a = true %}
{% endif %}
{% if line.title contains '商品B' %}
{% assign has_item_b = true %}
{% endif %}
{% if line.title contains '商品C' %}
{% assign has_item_c = true %}
{% endif %}
{% endfor %}
{% if has_item_a %}
{% if order.transactions[0].gateway == "Bank Deposit" %}
{% assign has_item_a = false %}
商品A銀行振込の文章
{% else %}
商品Aクレジットカードの文章
{% endif %}
{% elsif has_item_b %}
{% if order.transactions[0].gateway == "Bank Deposit" %}
{% assign has_item_b = false %}
商品B銀行振込の文章
{% else %}
商品Bクレジットカードの文章
{% endif %}
{% elsif has_item_c %}
{% if order.transactions[0].gateway == "Bank Deposit" %}
{% assign has_item_c = false %}
商品C銀行振込の文章
{% else %}
商品Cクレジットカードの文章
{% endif %}
{% endif %}
何時間も苦戦しているのですが、一向に解決できずにおります。
ご教授いただけますと幸いです。