FROM CACHE - jp_header
このコミュニティはピアツーピアサポートに移行しました。Shopify サポートは今後、このコミュニティへのサービスを提供いたしません。これからもぜひ、他のマーチャントやパートナーとつながり、サポートし合い、経験を共有してください。 当社の行動規範に違反する行動や削除を希望するコンテンツがありましたら、引き続きご報告ください

orderオブジェクトについて

orderオブジェクトについて

Sota_yohaku
観光客
11 4 4

こんにちわ。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オブジェクトの値がどのタイミングの注文内容となるか明記されているページも見つからなかったのでヘルプセンターに問い合わせましたが、対応範囲外といわれてしまったのでこちらに投稿させて頂きました。
該当の明細書のテンプレートは以下に貼り付けました。
オブジェクトに詳しいかたがいましたらご教授頂けますと幸いです。

 

よろしくお願い致します。

 

 

<div class="wrapper">
  <div class="customer-addresses">
    <div class="shipping-address">
      <p class="address-detail">

        {% if billing_address.city_province_zip != blank %}
        {{ billing_address.zip }}<br>
        {% endif %}
        {{billing_address.province}}
        {{ billing_address.city }}
        {% if billing_address != blank %}
        {{ billing_address.address1 }}
        {%  if billing_address.address2 != blank %}
        {{ billing_address.address2 }}<br>
        {% endif %}

        {% else %}
        No billing address<br>
        {% endif %}
        <span class="order-name"><br>{{billing_address.last_name}}{{billing_address.first_name}} 様</span>
        <br><br>
        [ご注文日] {{ order.created_at | date: "%Y-%m-%d %H:%M" }}<br>
        [注文番号] {{ order.order_number }}<br>
        <br><br>
        この度はお買い上げいただきありがとうございます。<br>
        下記の内容にて納品させていただきます。<br>
        ご確認いただきますよう、お願い致します。<br><br>
        <span class="order_total">総合計金額   {{ order.total_price | money }}円</span>
      </p>
    </div>
    <div class="billing-address">
      <p>
        **********<br /><br />
        ***********<br />
        ****************************<br />
        ************<br />
        ************<br /><br />
        ********<br />
        ***********************<br />
      </p>
      <p class="img">
        <img src="************************************" />
      </p>
    </div>
  </div>
  <div class="ship-text">
    <p class="meisai-title">お買い上げ明細</p>
    <p class="subtitle-bold to-uppercase">
      [お届け先]
    </p>
    <p class="address-detail">
      {% if shipping_address != blank %}

      {{ shipping_address.zip }}<br>
      {% endif %}
      {{shipping_address.province}}
      {{ shipping_address.city }}
      {% if shipping_address != blank %}
      {{ shipping_address.address1 }}
      {%  if shipping_address.address2 != blank %}
      {{ shipping_address.address2 }}<br>
      {% endif %}

      {% if shipping_address.phone != blank %}
      <br>
      {{ shipping_address.phone }}
      {% endif %}

      <br /><br />
      {{shipping_address.last_name}}{{shipping_address.first_name}} 様

      {% else %}
      No shipping address

      {% endif %}
    </p>
  </div>

  <div class="">

    {% 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 %}

    <table class="first-t">
      <tbody>
        <tr>
          <td class="t-c fb">商品コード</td>
          <td class="t-c fb">商品名</td>
          <td class="t-c fb">規格</td>
          <td class="t-c fb nowrap">数量</td>
          <td class="t-c fb">単価</td>
          <td class="t-c fb nowrap">金額(税込)</td>
        </tr>
        {% for line_item in line_items_in_shipment %}

        <tr>
          <td class="t-l">
            {% if line_item.sku != blank %}
            <span class="line-item-description-line">
              {{ line_item.sku }}
            </span>
            {% endif %}
          </td>

          <td class="t-l">
            {% for tax_line in line_item.tax_lines %}
            {{ tax_line.price | money }} {{ tax_line.title }}<br/>
            {% endfor %}
            {{ line_item.title }}
          </td>

          <td class="t-r">
            {{ line_item.variant_title }}
          </td>

          <td class="t-r">
            {{ line_item.shipping_quantity }}
          </td>

          <td class="t-r">
            {% assign final_price = nil %}
            {% for item in order.line_items %}
            {% if item.sku == line_item.sku %}
            {% assign final_price = item.final_price %}
            {% endif %}
            {% endfor %}
            {% if final_price %}
            {{ final_price | money }}円
            {% endif %}
          </td>

          <td class="t-r">
            {% assign final_price = nil %}
            {% for item in order.line_items %}
            {% if item.sku == line_item.sku %}
            {% assign final_price = item.final_price %}
            {% endif %}
            {% endfor %}
            {% if final_price %}
            {{ final_price | times: line_item.shipping_quantity | money }}円
            {% endif %}
          </td>
        </tr>
        {% endfor %}
        <tr>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
          <td class="t-r">商品合計</td>
          <td class="t-r">{{ order.subtotal_price | money }}円</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
          <td class="t-r">送料</td>
          <td class="t-r">{{ order.shipping_price | money }}円</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
          <td class="t-r nowrap">(内 消費税額)</td>
          <td class="t-r">({{ order.tax_price | money }}円)</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
          <td class="t-r">合計</td>
          <td class="t-r">{{ order.total_price | money }}円</td>
        </tr>
      </tbody>
    </table>


  </div>
  {% unless includes_all_line_items_in_order %}
  <hr class="subdued-separator">
  <p class="missing-line-items-text ">
    There are other items from your order not included in this shipment.
  </p>
  {% endunless %}

  {% if order.note != blank %}
  <div class="notes">
    <p class="subtitle-bold to-uppercase">
      Notes
    </p>
    <p class="notes-details">
      {{ order.note }}
    </p>
  </div>
  {% endif %}
  {% if delivery_method.instructions != blank %}
  <div class="notes">
    <p class="subtitle-bold to-uppercase">
      Delivery instructions
    </p>
    <p class="notes-details">
      {{ delivery_method.instructions }}
    </p>
  </div>
  {% endif %}

  <div class="footer">
    <table>
      <tbody>
        <tr>
          <td colspan="2" class="t-l fb tb bg">総お支払い合計</td>
        </tr>
        <tr>
          <td class="t-c">商品合計</td>
          <td class="t-r">{{ order.subtotal_price | money }}円</td>
        </tr>
        <tr>
          <td class="t-c">送料合計</td>
          <td class="t-r">{{ order.shipping_price | money }}円</td>
        </tr>
        <tr>
          <td class="t-c">(内 消費税額)</td>
          <td class="t-r">({{ order.tax_price | money }}円)</td>
        </tr>
        <tr>
          <td class="t-c">決済総額</td>
          <td class="t-r">{{ order.total_price | money }}円</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>
<style type="text/css">
body {
  font-size: 13px;
}

* {
  box-sizing: border-box;
}

.wrapper {
  width: 931px;
  margin: auto;
  padding: 0 4em;
  font-family: "Noto Sans", sans-serif;
  font-weight: 250;
}

.header {
  width: 100%;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  flex-direction: row;
  align-items: top;
}

.header p {
  margin: 0;
}

.shop-title {
  -webkit-box-flex: 6;
  -webkit-flex: 6;
  flex: 6;
  font-size: 1.9em;
}

.order-title {
  -webkit-box-flex: 4;
  -webkit-flex: 4;
  flex: 4;
}

.customer-addresses {
  width: 100%;
  display: inline-block;
  margin: 2em 0;
}

.address-detail {
  margin: 0.7em 0 0;
  line-height: 1.5;
}

.subtitle-bold {
  font-weight: bold;
  margin: 0;
  font-size: 0.85em;
}

.to-uppercase {
  text-transform: uppercase;
}

.text-align-right {
  text-align: right;
}

.shipping-address {
  float: left;
  min-width: 18em;
  max-width: 50%;
}

.billing-address {
  padding-left: 20em;
  min-width: 18em;
}

.order-container {
  padding: 0 0.7em;
}

.order-container-header {
  display: inline-block;
  width: 100%;
  margin-top: 1.4em;
}

.order-container-header-left-content {
  float: left;
}

.order-container-header-right-content {
  float: right;
}

.flex-line-item {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  flex-direction: row;
  align-items: center;
  margin: 1.4em 0;
  page-break-inside: avoid;
}

.flex-line-item-img {
  margin-right: 1.4em;
  min-width: {{ desired_image_size }}px;
}

.flex-line-item-description {
  -webkit-box-flex: 7;
  -webkit-flex: 7;
  flex: 7;
}

.line-item-description-line {
  display: block;
}

.flex-line-item-description p {
  margin: 0;
  line-height: 1.5;
}

.flex-line-item-quantity {
  -webkit-box-flex: 3;
  -webkit-flex: 3;
  flex: 3;
}

.subdued-separator {
  height: 0.07em;
  border: none;
  color: lightgray;
  background-color: lightgray;
  margin: 0;
}

.missing-line-items-text {
  margin: 1.4em 0;
  padding: 0 0.7em;
}

.notes {
  margin-top: 2em;
}

.notes p {
  margin-bottom: 0;
}

.notes .notes-details {
  margin-top: 0.7em;
}

.footer {
  margin-top: 2em;
  text-align: center;
  line-height: 1.5;
}

.footer p {
  margin: 0;
  margin-bottom: 1.4em;
}

hr {
  height: 0.14em;
  border: none;
  color: black;
  background-color: black;
  margin: 0;
}

.aspect-ratio {
  position: relative;
  display: block;
  background: #fafbfc;
  padding: 0;
}

.aspect-ratio::before {
  z-index: 1;
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border: 1px solid rgba(195,207,216,0.3);
}

.aspect-ratio--square {
  width: 100%;
  padding-bottom: 100%;
}

.aspect-ratio__content {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  display: block;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
}

.t-c {
  text-align: center;
}

.t-l {
  text-align: left;
}

.t-r {
  text-align: right;
}

table {
  width: 100%;
  border: solid 2px #000;
  margin: 10px 0;
  border-collapse: collapse;
  border-spacing: 0;
}

table td {
  border: solid 1px #000;
  min-height: 1em;
  margin: 0;
  padding: 5px;
}

.first-t tr:nth-child(odd) {
  background-color: rgb(177, 177, 177);
}

.bg {
  background-color: rgb(177, 177, 177);
}

.fb {
  font-weight: 600;
}
.tb {
  font-size: 19px;
}
.order-name {
  font-size: 15px;
  font-weight: 600;
  padding: 7px 0;
}
.order_total {
  font-size: 20px;
  font-weight: 600;
  border-bottom: solid #000 2px;
  padding-bottom: 4px;
}
.meisai-title {
  background-color: rgb(177, 177, 177);
  border: 2px solid #000;
  font-size: 19px;
  padding: 3px;
}
.billing-address {
  padding-left: 550px;
}
.img img {
  max-width: 150px;
}
.nowrap {
  white-space: nowrap;
}
</style>

 

0件の返信0