# Amazonpayのメールテンプレートカスタマイズに関して

**URL:** <https://community.shopify.com/t/amazonpay/138566>\
**Category:** 総合的なディスカッション\
**Created:** [July 28, 2022, 8:20am UTC](https://community.shopify.com/t/amazonpay/138566 "2022-07-28T08:20:18Z")\
**Posts on this page:** 11\
**Page:** 1

## AI-generated summary

Amazon Pay使用時のShopify受注メール未着と、メールテンプレートのカスタマイズが関係する問題。ブログ記事のコード反映後、注文完了ページは正常だが、Amazon Payでのみ受注メールが届かず。他の決済では受信できる。

切り分けとしてテンプレートを初期状態へ戻してテストしたところ、メール受信を確認。カスタマイズが原因の可能性が高い。

要望は、注文確認メール・注文編集メールに「Amazon Payにご登録の住所です。」のみを表示するための最小コードの提示。

対応として、Liquid（Shopifyのテンプレート言語）でtransactionsを走査し、statusがsuccess/pending、kindがauthorization/sale、gateway_display_nameが「Amazon Pay」の場合に該当文言を出力し、それ以外はbilling_addressを表示する記述が共有された。

現状は、提示コードで再テスト予定。最終的な解決報告は未了で、議論は継続中。

<div class="post-metadata">

**Author:** ![nekonote\_2022](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@nekonote\_2022](https://community.shopify.com/u/nekonote_2022)\
**Post date:** [July 28, 2022, 8:20am UTC](https://community.shopify.com/t/amazonpay/138566/1 "2022-07-28T08:20:18Z")

</div>

Amazon payの配送先と請求先が同じになる不具合に関して下記記事を参考にコードをコピーして反映しました。

[https://5-bit.jp/blogs/shopify/210925](https://5-bit.jp/blogs/shopify/210925)

注文完了ページに関しては記事の通り反映されたのですが、受注メールに関して受信の確認ができませんでした。

他の決済方法は通常通り受注メールの確認はとれています。

何か原因かわかりますでしょうか？

#

---

<div class="post-metadata">

**Author:** ![Anonymous\_3b9a8e857ec4e2560bc009f074375383](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/anonymous_3b9a8e857ec4e2560bc009f074375383/32/279353_2.png) [@Anonymous\_3b9a8e857ec4e2560bc009f074375383](https://community.shopify.com/u/Anonymous_3b9a8e857ec4e2560bc009f074375383)\
**Post date:** [July 28, 2022, 8:43am UTC](https://community.shopify.com/t/amazonpay/138566/2 "2022-07-28T08:43:57Z")

</div>

お世話になります。

株式会社5-bitの福水と申します。

この度は、弊社のブログ記事をご参照いただき、誠にありがとうございました。

問題の詳細を確認するために、お伺いしたいのですが、

> 注文完了ページに関しては記事の通り反映されたのですが、受注メールに関して受信の確認ができませんでした。

↑こちらの「受注メールに関して受信の確認ができなかった」というのは、どういった状態を指しているのでしょうか？

よろしければ、スクショなどでご教示いただけると幸いです。

ご確認の程、何卒よろしくお願い致します。

---

<div class="post-metadata">

**Author:** ![nekonote\_2022](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@nekonote\_2022](https://community.shopify.com/u/nekonote_2022)\
**Post date:** [July 28, 2022, 10:09am UTC](https://community.shopify.com/t/amazonpay/138566/3 "2022-07-28T10:09:39Z")

</div>

福永様

ブログ記載の企業様からのご返信すごく嬉しいです。

ありがとうございます。

受注メールに関してなのですが、記事の内容を検証するのにAmazon payでテスト購入を行なったのですが、受注メール自体が受信されませんでした。

他の決済の場合は通常通り受注メールを受信しております。

shopify様にも同時に相談したのですが、回答は得られませんでした。

少ない情報で申し訳ございませんがご教示いただけたら嬉しいです。

---

<div class="post-metadata">

**Author:** ![Anonymous\_3b9a8e857ec4e2560bc009f074375383](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/anonymous_3b9a8e857ec4e2560bc009f074375383/32/279353_2.png) [@Anonymous\_3b9a8e857ec4e2560bc009f074375383](https://community.shopify.com/u/Anonymous_3b9a8e857ec4e2560bc009f074375383)\
**Post date:** [July 28, 2022, 11:01am UTC](https://community.shopify.com/t/amazonpay/138566/4 "2022-07-28T11:01:59Z")

</div>

なるほど、ありがとうございます。

メールの受信自体ができないということは、カスタマイズが原因ではないように思えます。

問題の原因の切り分けをするために、お手数ですが、一度、メールテンプレートの中身を初期状態に戻した上で、再度AmazonPayのテスト注文を行ってみて、メールが届くかどうかご確認いただいてもよろしいでしょうか？

メールが届くかどうかにかかわらず、結果をまたここにご連絡いただければ、そこから何かしらご案内できるかもしれないです。

ご確認の程、何卒よろしくお願い致します。

---

<div class="post-metadata">

**Author:** ![nekonote\_2022](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@nekonote\_2022](https://community.shopify.com/u/nekonote_2022)\
**Post date:** [July 29, 2022, 12:45am UTC](https://community.shopify.com/t/amazonpay/138566/5 "2022-07-29T00:45:54Z")

</div>

ご回答ありがとうございます。

コードを変更する前はAmazonpay使用時も受注メールは届いておりました。

何かこちらで入れたコピーコードがおかしい可能性はありますでしょうか？

下記が御社の記事をみてコピーして、本番環境にいれたコードになります。

{% capture email\_title %}ご購入いただきありがとうございました! {% endcapture %}  
{% capture email\_body %}  
{% if requires\_shipping %}  
{% case delivery\_method %}  
{% when ‘pick-up’ %}  
注文の受取の準備が整うと、メールが届きます。  
{% when ‘local’ %}  
{{ customer.last\_name }}様、ご注文の品を配達する準備を行っております。  
{% else %}  
{{ customer.last\_name }}様、ご注文いただき、誠にありがとうございます。注文の発送準備を行なっております。商品が発送されましたら、Eメールにてお知らせいたします。  
{% endcase %}  
{% if delivery\_instructions != blank %}

**配達情報:** {{ delivery\_instructions }}

{% endif %} {% endif %} {% endcapture %} {{ email\_title }} .button\_\_cell { background: {{ shop.email\_accent\_color }}; } a, a:hover, a:active, a:visited { color: {{ shop.email\_accent\_color }}; }

| 

| 

| 

| {%- if shop.email\_logo\_url %} ![{{ shop.name }}](){%- else %}
# {{ shop.name }}
{%- endif %} | 注文 {{ order\_name }} |

 |

 |

| 

| 
## {{ email\_title }}

{{ email\_body }}

{% if order\_status\_url %}

| &nbsp; |
| 

| 注文を表示する |

{% if shop.url %}

| またはショップにアクセスする |

{% endif %} |

{% else %}  
{% if shop.url %}

| 

| ショップにアクセスする |

 |

{% endif %}

{% endif %}

 |

 |

{% assign gift\_card\_line\_item = line\_items | where: “gift\_card” %}  
{% if gift\_card\_line\_item.first %}

| 

| 
### ギフトカード
 |

| 

ギフトカードの個別のメールが届きます。

 |

 |

{% endif %}

| 

| 
### 注文概要
 |

| {% for line in subtotal\_line\_items %} {% endfor %}

| 

| {% if line.image %} ![](){% endif %} | {% if line.product.title %} {% assign line\_title = line.product.title %} {% else %} {% assign line\_title = line.title %} {% endif %}

{% if line.quantity \< line.quantity %}  
{% capture line\_display %} {{ line.quantity }} of {{ line.quantity }} {% endcapture %}  
{% else %}  
{% assign line\_display = line.quantity %}  
{% endif %}

{{ line\_title }}&nbsp;×&nbsp;{{ line\_display }}

{% if line.variant.title != ‘Default Title’ %}  
{{ line.variant.title }}  
  
{% endif %}

{% if line.selling\_plan\_allocation %}  
{{ line.selling\_plan\_allocation.selling\_plan.name }}  
  
{% endif %}

{% if line.refunded\_quantity \> 0 %}  
返金済み  
{% endif %}

{% if line.discount\_allocations %}  
{% for discount\_allocation in line.discount\_allocations %}  
{% if discount\_allocation.discount\_application.target\_selection != ‘all’ %}  
  
  ![]()  
   
{{ discount\_allocation.discount\_application.title | upcase }}  
(-{{ discount\_allocation.amount | money }})  
   
   
{% endif %}  
{% endfor %}  
{% endif %}

 | {% if line.original\_line\_price != line.final\_line\_price %} ~~{{ line.original\_line\_price | money }}~~ {% endif %}

{% if line.final\_line\_price \> 0 %} {{ line.final\_line\_price | money }} {% else %} 無料 {% endif %}

 |

 |

| | {% for discount\_application in discount\_applications %} {% if discount\_application.target\_selection == 'all' %} {% capture discount\_title %} {% if discount\_application.title %} {{ discount\_application.title | upcase }} {% else %} ディスカウント {% endif %} {% endcapture %}

{% endif %}  
{% endfor %}

{% if delivery\_method == ‘pick-up’ %}

{% else %}

{% endif %}

{% if current\_total\_duties %}

{% endif %}

{% if total\_tip and total\_tip \> 0 %}

{% endif %}

| 

ディスカウント ![]() {{ discount\_title }}

 | **-{{ discount\_application.total\_allocated\_amount | money }}** |
| 

小計

 | **{{ subtotal\_price | money }}** |
| 

受取

 | **{{ shipping\_price | money }}** |
| 

配送

 | **{{ shipping\_price | money }}** |
| 

関税

 | **{{ current\_total\_duties | money }}** |
| 

税金合計

 | **{{ tax\_price | money }}** |
| 

Tip

 | **{{ total\_tip | money }}** |

| 

合計

 | **{{ total\_price | money\_with\_currency }}** |

{% if total\_discounts \> 0 %}

割引 {{ total\_discounts | money }}

{% endif %}

{% assign transaction\_size = 0 %}  
{% assign transaction\_amount = 0 %}  
{% for transaction in transactions %}  
{% unless transaction.kind == “capture” or transaction.kind == “void” %}  
{% assign transaction\_size = transaction\_size | plus: 1 %}  
{% assign transaction\_amount = transaction\_amount | plus: transaction.amount %}  
{% endunless %}  
{% endfor %}

{% if transaction\_size \> 1 or transaction\_amount \< total\_price %}

{% for transaction in transactions %}  
{% if transaction.status == “success” and transaction.kind == “authorization” or transaction.kind == “sale” %}  
{% if transaction.payment\_details.credit\_card\_company %}  
{% capture transaction\_name %}{{ transaction.payment\_details.credit\_card\_company }} (カード番号下4桁: {{ transaction.payment\_details.credit\_card\_last\_four\_digits }}){% endcapture %}  
{% else %}  
{% capture transaction\_name %}{{ transaction.gateway\_display\_name }}{% endcapture %}  
{% endif %}

{% endif %}  
{% if transaction.kind == ‘refund’ %}  
{% if transaction.payment\_details.credit\_card\_company %}  
{% assign refund\_method\_title = transaction.payment\_details.credit\_card\_company %}  
{% else %}  
{% assign refund\_method\_title = transaction.gateway %}  
{% endif %}

{% endif %}  
{% endfor %}

| |
| |
| 

{{transaction\_name}}

 | **{{ transaction.amount | money }}** |
| 

返金  
{{ refund\_method\_title | capitalize }}

 | **- {{ transaction.amount | money }}** |

{% endif %} |

 |

 |

| 

| 
### お客様情報
 |

| {% if requires\_shipping and shipping\_address %} {% endif %} {% if billing\_address %} {% endif %}

| 
#### 配送先住所
{{ shipping\_address | format\_address }} | 
#### 請求先住所
{% assign isAmazonPay = false %} {% for transaction in transactions %} {% if transaction.status == "success" or transaction.status == "pending" %} {% if transaction.kind == "authorization" or transaction.kind == "sale" %} {% if transaction.gateway\_display\_name == "Amazon Pay" %} {% assign isAmazonPay = true %} {% endif %} {% endif %} {% endif %} {% endfor %} {% if isAmazonPay %} Amazon Payにご登録の住所です。 {% else %} {{ billing\_address | format\_address }} {% endif %} |

{% if requires\_shipping and shipping\_address %} {% endif %} {% assign transaction\_count = transactions | size %} {% if transaction\_count \> 0 %} {% endif %}

| 
#### 配送方法

{{ shipping\_method.title }}

 | 
#### 決済方法
{% for transaction in transactions %} {% if transaction.status == "success" or transaction.status == "pending" %} {% if transaction.kind == "authorization" or transaction.kind == "sale" %} {% if transaction.payment\_details.credit\_card\_company %}

![{{ transaction.payment_details.credit_card_company }}](){{ transaction.payment\_details.credit\_card\_last\_four\_digits }}で終わる — **{{ transaction.amount | money }}**

{% elsif transaction.gateway\_display\_name == "Gift card" %}

![](){{ transaction.payment\_details.gift\_card.last\_four\_characters | upcase }}で終わる — **{{ transaction.amount | money }}**   
   &nbsp;ギフトカード残高: {{ transaction.payment\_details.gift\_card.balance | money }}

{% else %}

{{ transaction.gateway\_display\_name }} — **{{ transaction.amount | money }}**

{% endif %} {% endif %} {% endif %} {% endfor %} |

 |

 |

| 

| 

ご不明な点がございましたら、このメールにご返信いただくか、{{ shop.email }}までご連絡ください。

 |

 |

![]()

 |

---

<div class="post-metadata">

**Author:** ![Anonymous\_3b9a8e857ec4e2560bc009f074375383](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/anonymous_3b9a8e857ec4e2560bc009f074375383/32/279353_2.png) [@Anonymous\_3b9a8e857ec4e2560bc009f074375383](https://community.shopify.com/u/Anonymous_3b9a8e857ec4e2560bc009f074375383)\
**Post date:** [July 29, 2022, 12:49am UTC](https://community.shopify.com/t/amazonpay/138566/6 "2022-07-29T00:49:46Z")

</div>

ありがとうございます。

繰り返しになってしまい、大変恐縮なのですが、問題の切り分けをするために、一度、メールテンプレートの中身を初期状態に戻した上で、再度AmazonPayのテスト注文を行ってみて、メールが届くかどうかご確認いただいてもよろしいでしょうか？

---

<div class="post-metadata">

**Author:** ![nekonote\_2022](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@nekonote\_2022](https://community.shopify.com/u/nekonote_2022)\
**Post date:** [August 1, 2022, 1:03am UTC](https://community.shopify.com/t/amazonpay/138566/7 "2022-08-01T01:03:49Z")

</div>

ご返答ありがとうござます。

一度、変更前の状態に戻しメールの受信確認を行なってみます。

---

<div class="post-metadata">

**Author:** ![nekonote\_2022](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@nekonote\_2022](https://community.shopify.com/u/nekonote_2022)\
**Post date:** [August 1, 2022, 2:38am UTC](https://community.shopify.com/t/amazonpay/138566/8 "2022-08-01T02:38:26Z")

</div>

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

メールのテンプレートを戻してテストしたところ以前のように受信の確認がとれました。

何か問題解決の糸口がございますでしょうか？

---

<div class="post-metadata">

**Author:** ![nekonote\_2022](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@nekonote\_2022](https://community.shopify.com/u/nekonote_2022)\
**Post date:** [August 1, 2022, 7:55am UTC](https://community.shopify.com/t/amazonpay/138566/9 "2022-08-01T07:55:28Z")

</div>

五月雨式に質問してしまい申し訳ございません。

・注文確認メール

・注文編集メール

の２点に関して

Amazon Payにご登録の住所です。

を表示するのに必要なコードだけ抜粋いただければ解決できそうな気もするのですが、いかがでしょうか？

本当にお手数かけてしまい申し訳ないですがお力添えいただけると助かります！

---

<div class="post-metadata">

**Author:** ![Anonymous\_3b9a8e857ec4e2560bc009f074375383](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/anonymous_3b9a8e857ec4e2560bc009f074375383/32/279353_2.png) [@Anonymous\_3b9a8e857ec4e2560bc009f074375383](https://community.shopify.com/u/Anonymous_3b9a8e857ec4e2560bc009f074375383)\
**Post date:** [August 2, 2022, 1:35am UTC](https://community.shopify.com/t/amazonpay/138566/10 "2022-08-02T01:35:33Z")

</div>

お世話になります。

該当の文言を出力するための記述は、下記の通りです。

```markup
{% assign isAmazonPay = false %}
{% for transaction in transactions %}
{% if transaction.status == "success" or transaction.status == "pending" %}
{% if transaction.kind == "authorization" or transaction.kind == "sale" %}
{% if transaction.gateway_display_name == "Amazon Pay" %}
{% assign isAmazonPay = true %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% if isAmazonPay %}
Amazon Payにご登録の住所です。
{% else %}
{{ billing_address | format_address }}
{% endif %}

```

ご確認のほど、よろしくお願いします！

---

<div class="post-metadata">

**Author:** ![nekonote\_2022](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@nekonote\_2022](https://community.shopify.com/u/nekonote_2022)\
**Post date:** [August 2, 2022, 4:52am UTC](https://community.shopify.com/t/amazonpay/138566/11 "2022-08-02T04:52:20Z")

</div>

ありがとうございます。

上記で試してみます。
