從 Order Printer 應用程式移轉到 Shopify Order Printer
此頁面列印時間為 May 20, 2024。如須最新版本,請至 https://help.shopify.com/zh-TW/manual/orders/printing-orders/shopify-order-printer/migration。
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
這些變數可以用 fulfillments
或 order.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_gateways
或transactions.<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_method
、payment_methods
。請用訂單交易的 transaction.gateway_display_name 欄位。付款方式已經不再分類為{credit card, debit card, bank transfer}
這類特定類型。舊版 Order Printer 只能將目前使用的部分付款閘道對應到這些類別。付款閘道供應商會自行管理顧客使用的付款方式類型。