・設定>チェックアウト>顧客アカウント>アカウントを任意にする または アカウントを必要とする
と設定した場合に、ユーザー画面で確認できる下記2つのテンプレートについて、
不明点があり、質問を挙げさせていただきました。
/account/ マイページ
/account/orders/ 注文履歴(詳細)
■質問内容
上記2つのテンプレートに、注文の合計金額が表示されますが、
・Shopify管理画面>注文管理>該当注文の詳細画面>編集>アイテムを削除
または
・Shopify管理画面>注文管理>該当注文の詳細画面>編集>数量を調整
の操作した場合でも、ユーザー画面の上記2テンプレートに変更が反映されず、
従来の内容のままとなっております。
※管理画面側は、正しく変更されております。
※テンプレートはDebutをカスタマイズせずに利用しております。
こちらテンプレートを調整し、改善できるなど
方法がありましたらご教授いただければ幸いです。
以下の修正は参考になりますでしょうか?
customer/order.liquidの最初に以下のコードを挿入
{% assign cancelled_subtotal = 0 %}
{% for refund in order.refunds %}
{% for item in refund.refund_line_items %}
{% assign cancelled_subtotal = cancelled_subtotal | plus:item.line_item.price %}
{% endfor %}
{% endfor %}
{% assign final_cancelled_with_tax = cancelled_subtotal| times:1.1 %}
{% assign order_subtotal_with_tax = order.subtotal_price| times:1.1%}
{% assign shipping_with_tax = order.shipping_price| times:1.1%}
{% if final_cancelled_with_tax == order_subtotal_with_tax %}
{% assign final_cancelled_with_tax = final_cancelled_with_tax | plus:shipping_with_tax %}
{% endif %}
{{ order.total_price | money }} を {{ order.total_price | minus:cancelled_subtotal | money }} に置き換え。
Liquidの知識が必要になりますが、
https://shopify.dev/docs/themes/liquid/reference/objects/order
> ただ、小計金額には、「アイテムを削除」「数量を調整」を考慮した金額が反映されておらず、
{% for refund in order.refunds %}
{% for item in refund.refund_line_items %}
これを応用して、承継金額の表示部分も同じように修正する必要があると思います。
> ページで表示される合計金額も「アイテムを削除」「数量を調整」を考慮した金額を表示したいのですが、可能でしょうか?
Liquidのcustomerから同様のorderが参照できるので、同じ修正が可能かと思います。
https://shopify.dev/docs/themes/liquid/reference/objects/customer#customer-orders
同じ現象で悩んだので、そういった明細に触るためのLIQUID例はこれ。
ご参考になれば。
{% for order in customer.orders %}
のループ内で、以下を入れれば返品や削除された商品を特定できます。