從 Order Printer 應用程式移轉到 Shopify Order Printer

Shopify Order Printer 的 Liquid 實做方式和原本的 Order Printer 稍有不同。如果想移轉範本,您需要手動複製現有範本的程式碼,然後把程式碼貼到新的應用程式中,並按照本指南的說明調整必要內容。如果您的範本有加入任何自訂 CSS,您也需要為了新的應用程式轉移和調整這些內容。

從全域命名空間中移除的訂單屬性

如果想存取訂單屬性,請在前方加上 order.。例如 billing_address 現在須用 order.billing_address 存取。

為了方便使用,幾種常用的訂單屬性不需要 order. 前綴也能繼續存取:

  • line_items
  • tax_lines
  • fulfillments
  • transactions
  • discounts
  • refunds
  • shipping_methods
  • customer

這些變數可以用 fulfillmentsorder.fulfillments 等方式存取。

停用欄位

為了配合最新的 Shopify 資料模型,我們重新命名或停用了幾種物件使用的欄位,這些欄位可能已有替代內容,或是可以使用以下內文所說的方式達到相同效果。如果您的範本需要存取這些欄位,請把它們取代為說明提供的替代欄位或程式碼部分。

訂單

實做差異:

  • line_items。line_items 集合內不含退款商品項目。請透過 refunds.<each>.refunded_line_items 存取退款商品項目。

已有替代內容的停用欄位:

  • credit_card。請使用每筆訂單內的交易付款詳細資訊:transactions.each.payment_details
  • current_shipping_price。請改為使用 shipping_price
  • date。請改為使用 created_at
  • gateways。請改為使用 unique_gatewaystransactions.<each>.gateway
  • order_currency。請改為使用 currency
  • processed_at。請改為使用 created_at
  • payment_transactions。請用 order.transactions 篩選 Liquid 語法使用的種類和狀態,並選擇其中含有 where,或同時含有迴圈和 if 的項目。
  • refund_transactions。請用 order.transactions 篩選 Liquid 語法使用的種類和狀態,並選擇其中含有 where,或同時含有迴圈和 if 的項目。
  • shipping_line。請用 shipping_methods | first
  • shipping_lines。請用 shipping_methods
  • show_line_item_taxes。請用 tax_lines.size > 0。您可以在範本開頭將這個項目定義為變數,以便重複參照使用:{% assign show_line_item_taxes = tax_lines.size > 0 %}
  • total_tax。請用 tax_price
  • total_paid。請用 net_payment

LineItem

已有替代內容的停用欄位:

  • fulfillable_quantity。請用 quantity - successfully_fulfilled_quantity
  • fulfilled。計算 quantity == successfully_fulfilled_quantity 狀況。
  • name。請用 title
  • product_title。請用 product.title
  • unit_discount。計算 quantity ? total_iscount / quantity : 0
  • variant_title。請用 variant.title
  • weight。請用 grams

出貨作業

已有替代內容的停用欄位:

  • date。請用 created_at

Shop

已有替代內容的停用欄位:

  • owner - 請用 account_owner.name

以下欄位請用 shop.address.<field_name> 參照:

  • address - 請用 shop.address.address1
  • address2 - 請用 shop.address.address2
  • city - 請用 shop.address.city
  • country - 請用 shop.address.city
  • country_code - 請用 shop.address.country_code
  • province - 請用 shop.address.province
  • province_code - 請用 shop.address.province_code
  • zip - 請用 shop.address.zip

地址

已有替代內容的停用欄位:

  • latitude - 如果 location 參照了 address,那麼 location 物件就已經有提供經緯度。
  • Longitude - 如果 location 參照了 address,那麼 location 物件就已經有提供經緯度。

退款

已有替代內容的停用欄位:

  • date。請用 created_at

運送路線

已有替代內容的停用欄位:

  • current_price。請用 price
  • price。請用 original_price

交易

移除的欄位:

  • authorization
  • message
  • test

變體

已有替代內容的停用欄位:

  • grams。請用 weight

停用篩選條件

已有替代內容的停用欄位:

  • files_url。請用 file_url
  • payment_methodpayment_methods。請用訂單交易的 transaction.gateway_display_name 欄位。付款方式已經不再分類為 {credit card, debit card, bank transfer} 這類特定類型。舊版 Order Printer 只能將目前使用的部分付款閘道對應到這些類別。付款閘道供應商會自行管理顧客使用的付款方式類型。

準備好開始透過 Shopify 銷售商品了嗎?

免費試用