# 特定のコレクション内の商品を購入したときだけ、注文確認メールに注意事項を記載したい

**URL:** <https://community.shopify.com/t/topic/220885>\
**Category:** 技術的なQ＆A\
**Created:** [June 1, 2023, 6:27am UTC](https://community.shopify.com/t/topic/220885 "2023-06-01T06:27:54Z")\
**Posts on this page:** 3\
**Page:** 1

## AI-generated summary

特定のコレクション内の商品が購入された場合にのみ、注文確認メールに注意事項を表示させたいという質問です。

**提案された解決策:**
- `order.line_items` の代わりに `line_items` 変数を使用する
- `item.product.collections contains 'コレクションID'` で条件分岐を行う

コード例:
```
{% for item in line_items %}
  {% if item.product.collections contains 'コレクションID' %}
    ## 特定のコレクションの注意事項
  {% endif %}
{% endfor %}
```

**現状:**
質問者が提案されたコードを試したものの、うまく動作しなかったと報告しており、解決には至っていない状況です。

<div class="post-metadata">

**Author:** ![tatsuki\_ttt](https://avatars.discourse-cdn.com/v4/letter/t/e8c25b/32.png) [@tatsuki\_ttt](https://community.shopify.com/u/tatsuki_ttt)\
**Post date:** [June 1, 2023, 6:27am UTC](https://community.shopify.com/t/topic/220885/1 "2023-06-01T06:27:54Z")

</div>

お世話になります。

注文確認メールのカスタマイズについて質問です。

特定のコレクションに含まれる商品を購入したときだけ

注文確認メールに注意事項を記載したいと思っております。

```css
{% for item in order.line_items %}
  {% if item.product.collections contains 'コレクションID' %}
    ## 特定のコレクションの注意事項
    

このコレクションの商品に関する注意事項です。

  {% endif %}
{% endfor %}

```

上記のようなコードをメール内に記載しておりますが、うまくいきません。

どこか間違っているのか、もしくはまったく方法が違うのか･･･。

教えていただけると嬉しいです。

---

<div class="post-metadata">

**Author:** ![Anonymous\_44fbe07fc59d9ccaacd70575fd5a5155](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/anonymous_44fbe07fc59d9ccaacd70575fd5a5155/32/194200_2.png) [@Anonymous\_44fbe07fc59d9ccaacd70575fd5a5155](https://community.shopify.com/u/Anonymous_44fbe07fc59d9ccaacd70575fd5a5155)\
**Post date:** [June 1, 2023, 8:49am UTC](https://community.shopify.com/t/topic/220885/2 "2023-06-01T08:49:08Z")

</div>

お世話になっております。

可能性としてですが、orderという変数は不要かもしれません。

```markup
{% for item in line_items %}
  {% if item.product.collections contains 'コレクションID' %}
    ## 特定のコレクションの注意事項
    

このコレクションの商品に関する注意事項です。

  {% endif %}
{% endfor %}

```

お試しいただけますと幸いです。

なにかヒントになれば幸いです。

私たちの励みにもなりますので、

お役に立てていればBest Answerボタンを押して頂ければ嬉しいです。

---

<div class="post-metadata">

**Author:** ![tatsuki\_ttt](https://avatars.discourse-cdn.com/v4/letter/t/e8c25b/32.png) [@tatsuki\_ttt](https://community.shopify.com/u/tatsuki_ttt)\
**Post date:** [June 5, 2023, 4:13am UTC](https://community.shopify.com/t/topic/220885/3 "2023-06-05T04:13:15Z")

</div>

ありがとうございます。

ご提示いただいたコードで設定してみましたが、うまくいきませんでした･･･。
