こんにちわ。orderオブジェクトの中身についての質問です。
orderオブジェクトは注文された内容を扱えるオブジェクトですが、このオブジェクト内容はいつの注文内容を参照しているかが分かりません。
問題が起きたのは、注文の明細書です。
お客様がショップで決済した内容は以下の通りです。
・商品A(税込み550円) × 2点
・商品B(税込み550円)
・商品C(税込み550円)
・商品D(税込み550円)
・商品E(税込み550円)
・商品F(税込み550円)
・商品G(税込み550円)
・商品H(税込み550円)
・商品I(税込み550円)
小計(10商品) : 5500円
配送 : 360円
税 : 500円
合計 : 5860円
決済が完全に完了した後にお客様から注文内容の変更をお願いをされ以下の内容に変更しました。
・商品A(税込み550円)
・商品B(税込み550円)
・商品C(税込み550円)
・商品D(税込み550円)
・商品E(税込み550円)
・商品F(税込み550円)
・商品G(税込み550円)
・商品H(税込み550円)
・商品I(税込み550円)
・商品J(税込み550円)
小計(10商品) : 5500円
配送 : 360円
税 : 500円
合計 : 5860円
商品Aを1つに変更し、商品Jを追加されました。注文内容は変更されましたが、小計・配送・税・合計の変更はありませんでした。
注文内容を変更した状態で明細書を発行しようとしたら明細書の内容が以下となっておりました。
{{ order.subtotal_price | money }} : 6050円
{{ order.shipping_price | money }} : 360円
{{ order.tax_price | money }} : 550円
{{ order.total_price | money }} : 6410円
となっており、11点分の合計になっていました。
orderオブジェクトの仕様で、
・ (一回目の注文の 10点) - (変更後削除された商品2点(商品A× 2点)) + (変更後追加された注文 2点(商品A,商品J))
となっていればよいのですが実際には、
・(一回目の注文の 10点) + (変更後追加された1点(商品J)) のような結果となっていました。
orderオブジェクトの値がどのタイミングの注文内容となるか明記されているページも見つからなかったのでヘルプセンターに問い合わせましたが、対応範囲外といわれてしまったのでこちらに投稿させて頂きました。
該当の明細書のテンプレートは以下に貼り付けました。
オブジェクトに詳しいかたがいましたらご教授頂けますと幸いです。
よろしくお願い致します。
{% if billing_address.city_province_zip != blank %}
{{ billing_address.zip }}
{% endif %}
{{billing_address.province}}
{{ billing_address.city }}
{% if billing_address != blank %}
{{ billing_address.address1 }}
{% if billing_address.address2 != blank %}
{{ billing_address.address2 }}
{% endif %}
{% else %}
No billing address
{% endif %}
{{billing_address.last_name}}{{billing_address.first_name}} 様
[ご注文日] {{ order.created_at | date: "%Y-%m-%d %H:%M" }}
[注文番号] {{ order.order_number }}
この度はお買い上げいただきありがとうございます。
下記の内容にて納品させていただきます。
ご確認いただきますよう、お願い致します。
総合計金額 {{ order.total_price | money }}円
**********
***********
****************************
************
************
********
***********************
お買い上げ明細
[お届け先]
{% if shipping_address != blank %}
{{ shipping_address.zip }}
{% endif %}
{{shipping_address.province}}
{{ shipping_address.city }}
{% if shipping_address != blank %}
{{ shipping_address.address1 }}
{% if shipping_address.address2 != blank %}
{{ shipping_address.address2 }}
{% endif %}
{% if shipping_address.phone != blank %}
{{ shipping_address.phone }}
{% endif %}
{{shipping_address.last_name}}{{shipping_address.first_name}} 様
{% else %}
No shipping address
{% endif %}
{% comment %}
To adjust the size of line item images, change desired_image_size.
The other variables make sure your images print at high quality.
{% endcomment %}
{% assign desired_image_size = 58 %}
{% assign resolution_adjusted_size = desired_image_size | times: 300 | divided_by: 72 | ceil %}
{% capture effective_image_dimensions %}
{{ resolution_adjusted_size }}x{{ resolution_adjusted_size }}
{% endcapture %}
{% for line_item in line_items_in_shipment %}
{% endfor %}
| 商品コード | 商品名 | 規格 | 数量 | 単価 | 金額(税込) |
| - | - | - | - | - | - |
| <br> {% if line_item.sku != blank %}<br> <br> {{ line_item.sku }}<br> <br> {% endif %}<br> | <br> {% for tax_line in line_item.tax_lines %}<br> {{ tax_line.price | money }} {{ tax_line.title }}<br><br> {% endfor %}<br> {{ line_item.title }}<br> | <br> {{ line_item.variant_title }}<br> | <br> {{ line_item.shipping_quantity }}<br> | <br> {% assign final_price = nil %}<br> {% for item in order.line_items %}<br> {% if item.sku == line_item.sku %}<br> {% assign final_price = item.final_price %}<br> {% endif %}<br> {% endfor %}<br> {% if final_price %}<br> {{ final_price | money }}円<br> {% endif %}<br> | <br> {% assign final_price = nil %}<br> {% for item in order.line_items %}<br> {% if item.sku == line_item.sku %}<br> {% assign final_price = item.final_price %}<br> {% endif %}<br> {% endfor %}<br> {% if final_price %}<br> {{ final_price | times: line_item.shipping_quantity | money }}円<br> {% endif %}<br> |
| | | | | | |
| | | | | 商品合計 | {{ order.subtotal_price | money }}円 |
| | | | | 送料 | {{ order.shipping_price | money }}円 |
| | | | | (内 消費税額) | ({{ order.tax_price | money }}円) |
| | | | | 合計 | {{ order.total_price | money }}円 |
{% unless includes_all_line_items_in_order %}
---
There are other items from your order not included in this shipment.
{% endunless %}
{% if order.note != blank %}
Notes
{{ order.note }}
{% endif %}
{% if delivery_method.instructions != blank %}
Delivery instructions
{{ delivery_method.instructions }}
{% endif %}
<table>
<tr>
<td colspan="2">
総お支払い合計
</td>
</tr>
<tr>
<td>
商品合計
</td>
<td>
{{ order.subtotal_price | money }}円
</td>
</tr>
<tr>
<td>
送料合計
</td>
<td>
{{ order.shipping_price | money }}円
</td>
</tr>
<tr>
<td>
(内 消費税額)
</td>
<td>
({{ order.tax_price | money }}円)
</td>
</tr>
<tr>
<td>
決済総額
</td>
<td>
{{ order.total_price | money }}円
</td>
</tr>
</table>