通知變數參考
商店寄出的通知是使用 Liquid 產生的。Liquid 是 Shopify 所採用、簡單好用的程式語言。Theme Store 中的佈景主題也是使用相同的程式語言打造。
若要編輯商店寄出的通知,您可以在通知範本中 make basic customizations。如需查看可自訂的通知完整清單,請到您的 Shopify 管理介面的 Notifications 頁面。
若需要進行更進階的變更,或要修改自訂通知範本,您可以在我們的 forums 向社群尋求協助,或聘僱 Shopify 合作夥伴為您進行自訂。 深入瞭解 hiring a Shopify Partner。
本頁內容
- Order properties
- Draft order properties
- Payment schedule properties
- Payment status properties
- Bundle component properties
- Component properties
- Line item properties
- Line item group properties
- Refunds properties
- Fulfillment properties
- Prepared package properties
- Delivery properties
- Discount properties
- Subscription properties
- Email notification properties
- Store credit properties
訂單屬性
訂單的許多屬性可直接在 Liquid 與範本中使用。
| 屬性 | 說明 |
|---|---|
id |
系統範圍的訂單唯一 ID,供內部使用。請參考下例,產生連至商店管理介面中該訂單的連結。例如,您可以在 新訂單 範本中加入以下程式碼: View order
|
email | 與該訂單關聯的電子郵件地址。 |
name |
通常會以井號 (#) 開頭 範例:#1004 |
order_name | 與名稱相同。 |
order_number |
商店中訂單的唯一編號,不含井號 (#) 前綴,亦不包含商店擁有者在商店偏好設定中為訂單 ID 新增的任何前綴或後綴。 範例:1004 |
confirmation_number | 為該訂單隨機產生的英數識別碼,可能會改為顯示給顧客,而非連號的訂單名稱。此值無法保證唯一。 範例:XPAV284CT |
created_at |
顧客建立訂單的日期與時間。您可以使用 date 篩選器設定格式。 範例:2009-05-30T17:43:51+02:00 |
payment_terms |
付款條件會指定該訂單的付款到期日。 瞭解如何 add payment terms to order invoices。 如需更多詳情,請參閱 Liquid 參考資料中的 payment_terms。 |
destination | 品項應運送至的收件地。 |
tags | 傳回包含訂單所有標籤的陣列。傳回的標籤會依字母順序排列。系統產生通知電子郵件時,應用程式或平台功能動態套用的標籤 (例如 Shopify Collective 標籤) 可能無法使用。若要偵測特定功能的品項,請改為檢查每個商品項目的商品層級標籤。若需詳細資訊,請參閱Liquid 參考文件。 |
transactions | 傳回來自訂單的 transactions 陣列。 |
tax_price | 訂單中所有品項的稅額總和。 |
tax_lines |
依稅別分列的稅額:
{% for tax_line in tax_lines %}
{{ tax_line.title }} ({{ tax_line.rate_percentage }}%) : {{ tax_line.price | money_with_currency }}
{% endfor %}
|
tax_line.title | 稅種名稱。例如:QST 或加值稅 (VAT)。 |
tax_line.price | 稅額。 |
tax_line.rate | 以小數表示的稅率。若為 17.5%,則會傳回 0.175。 |
tax_line.rate_percentage | 以易讀格式表示的稅率。若稅率為 0.175,則會傳回 17.5。 |
customer | 顧客物件,內含 customer 輸出的屬性。 |
billing_address | billing address。 |
billing_address.first_name | 顧客的名字。 |
billing_address.last_name | 顧客的姓氏。 |
billing_address.company | 用於帳單的公司名稱。 |
billing_address.phone | 帳單地址中的電話號碼。 |
shop.name | 您的商店名稱。 |
shop.phone | 您的商店電話號碼。 |
subtotal_price | 在扣除各商品項目折扣或購物車折扣後,訂單中各商品項目的價格總和。小計不包含稅額 (除非價格已含稅)、運送成本或小費。 |
discounts | discounts 清單。 |
discounts_amount | 所有折扣合計套用的金額。 範例:+$5.00 |
discounts_savings | 所有折扣所產生的節省金額。 範例:-$5.00 |
total_price |
訂單總額 (小計 + 運送成本 - 運送折扣 + 稅額)。 |
financial_status | 目前的付款狀態。可能值:nil、pending、authorized、paid、voided、refunded。 |
requires_shipping | (布林值) 如果訂單中至少有一個品項需要運送,則傳回 true。 |
shipping_method.title | 運費費率名稱。 在面向顧客的通知中,若顧客結帳所用語言與商店預設語言不同,系統會將運費費率名稱翻譯為顧客結帳所用的語言。 範例:Standard Shipping |
shipping_method.price |
包含任何運送折扣後的運費金額。 範例: |
shipping_price |
運費金額。 範例: |
shipping_address | shipping address。 |
shipping_address.first_name | 運送地址中的名字。 |
shipping_address.company | 運送地址的公司名稱。 |
shipping_address.phone | 運送地址中的電話號碼。 |
line_items | 訂單中所有 line items 的清單。 |
line_items_including_zero_quantity | 訂單中所有 line items 的清單,包括數量為 0 的商品項目。當商品項目已全額退款時,其數量會變為 0。 |
line_item_groups(Orders and POS only) | 訂單中包含商品項目元件的所有 line item groups 清單。 |
item_count | 所有品項數量的總和。 |
fulfillment_status | 訂單目前的出貨狀態。可能值:unfulfilled、partial、fulfilled。 |
note | 附加在訂單上的備註。此備註可由顧客提供,並且可以在管理介面的訂單詳情畫面中編輯。 |
attributes |
任何附加在訂單上的 attributes。 範例: |
metafields |
訂單上的任何中繼欄位。請使用下列語法: metafields.NAMESPACE.KEY |
referring_site |
包含將顧客帶到您商店的轉介方網址。 範例: |
landing_site |
包含顧客到達頁面的路徑。這是顧客進入商店時看到的第一個頁面。 範例: |
landing_site_ref |
解析到達頁面,並從中擷取參照參數。參照參數可以是: 如果
{% if landing_site_ref == 'my-tracking-token' %}
My action...
{% endif %}
|
cancelled | (布林值) 如果訂單已取消,則傳回 true。 |
cancelled_at | 訂單取消的時間。 |
cancel_reason | 取消訂單時所選的原因。可能值:inventory、customer、declined、fraud 或 other。 |
has_high_risks?(deprecated) | 若訂單具有高風險則傳回 true |
unique_gateways |
傳回訂單中不重複的付款服務供應商清單。例如,若有人以 Visa、Mastercard 與現金付款,則傳回的清單會是 |
location(POS only) |
顯示訂單的實體地點。有多個地點屬性可用,列在 此處。您可以在 管理介面中的 Locations 區域 設定地點。 |
order_status_url |
傳回此筆訂單的訂單狀態頁面連結。 |
fulfilled_line_items(deprecated) | 已履行的 商品項目 清單。 |
unfulfilled_line_items(deprecated) | 尚未完全履行的 商品項目 清單。 |
b2b? |
若該訂單為 B2B 訂單則會傳回 true。請搭配 B2B 變數使用此屬性,以在電子郵件中顯示相關資訊,例如公司名稱、公司地址與地址。舉例來說,在 B2B 訂單上,您可以在範本中加入頁首,內含下列資訊:
{% if b2b? %}
<p> Customer: {{ customer.name }}
<p> Company: {{ company.name }}
<p> Location: {{ company_location.name }}
{% endif%}
|
company | B2B 訂單中您要銷售給的 公司。 |
company.name | B2B 訂單中的公司名稱。 |
company.id | B2B 訂單中的公司 ID。 |
company_location | B2B 訂單中公司的 地址。向您採購的公司可能擁有多個地址。 |
company_location.name | B2B 訂單中的公司地址名稱。 |
company_location.id | B2B 訂單中的公司地址 ID。 |
company_location.shipping_address | B2B 訂單中該公司地址的 運送地址。 |
company_location.billing_address | B2B 訂單中該公司地址的 帳單地址。 |
customer_order_url | 顧客透過 customer accounts 申請退貨的訂單,其 new order status page。 |
訂單草稿屬性
| 屬性 | 說明 |
|---|---|
id | 供內部使用的訂單草稿唯一 ID。 |
invoice_url | 顧客可用來透過 Shopify 的安全結帳支付發票的連結。 |
reserve_inventory_until |
草稿中商品項目的保留截止日期與時間,例如 您可以使用 Liquid 的 date filter 來設定日期格式。 |
user | 最後修改訂單草稿的員工。 |
user.name | 最後修改訂單草稿的員工姓名。 |
user.email | 最後修改訂單草稿的員工電子郵件地址。 |
email | 與訂單草稿關聯的電子郵件地址。 |
name | 訂單草稿的唯一 number ,且前面帶有井字號 #。 |
number | 不含訂單前綴或後綴的訂單草稿唯一編號。 |
created_at |
顧客建立訂單草稿的日期與時間,例如 您可以使用 Liquid 的 date filter 來設定日期格式。 |
tags | 傳回該訂單所有標籤的陣列。標籤會依字母順序傳回。詳情請參閱 Liquid reference documentation。 |
tax_price | 訂單草稿中所有品項的稅額總和。 |
tax_lines |
依稅種分列的稅額:
{% for tax_line in tax_lines %}
{{ tax_line.title }} ({{ tax_line.rate_percentage }}%) : {{ tax_line.price | money_with_currency }}
{% endfor %}
|
tax_line.title | 稅種名稱。 例如:QST 或 加值稅 (VAT) |
tax_line.price | 稅額。 |
tax_line.rate | 以小數表示的稅率。例如,17.5% 的稅率會傳回 0.175。 |
tax_line.rate_percentage | 以百分比表示的稅率。例如,rate 為 0.175 時會傳回 17.5。 |
customer | 顧客物件,內含 customer 輸出的屬性。 |
billing_address | 訂單草稿的 帳單地址。 |
billing_address.first_name | 顧客的名字。 |
billing_address.last_name | 顧客的姓氏。 |
billing_address.company | 帳單地址中的公司名稱。 |
billing_address.phone | 帳單地址中的電話號碼。 |
shop.name | 您的商店名稱。 |
shop.phone | 您的商店電話號碼。 |
subtotal_price | 扣除所有商品項目折扣或購物車折扣後,訂單草稿中各商品項目的價格總和。小計不包含稅額 (除非價格已含稅) 或運送成本。 |
discounts | discounts 清單。 |
discounts_amount | 所有折扣套用後的折扣金額。 範例:+$5.00 |
discounts_savings | 所有折扣帶來的節省金額。 範例:-$5.00 |
total_price | 訂單的總價 (小計 + 運送成本 - 運送折扣 + 稅額)。 |
amount_due_now | 訂單草稿發票應付金額。 |
requires_shipping | 傳回 true ,如果訂單草稿中至少有一個品項需要運送。傳回 false 如果訂單草稿中沒有任何品項需要運送。 |
shipping_method.title | 運送方式名稱。 範例:Standard Shipping |
shipping_method.price | 運送方式的價格。傳回的資訊與 shipping_price。 |
shipping_price |
運費金額。 您可以使用 Liquid 的 money filters 來格式化此金額。 |
shipping_address |
注意:與一般訂單不同,訂單草稿的運送地址可能不完整。 |
shipping_address.first_name | 運送地址中的名字。 |
shipping_address.company | 運送地址中的公司名稱。 |
shipping_address.phone | 運送地址中的電話號碼。 |
line_items | 訂單草稿中所有 商品項目 的清單。 |
item_count | 訂單草稿中所有品項數量的總和。 |
note | 附加在訂單草稿上的備註。此備註可由顧客提供,也可在您的 Shopify 管理介面的訂單草稿詳細資料畫面中編輯。 |
metafields |
訂單草稿上的任何中繼欄位。請使用下列語法: metafields.NAMESPACE.KEY |
location |
訂單的實體地點。有多個可用的 地點屬性。 您可以在 Shopify 管理介面的 Locations 頁面中設定地點。 |
b2b? |
若該訂單為 B2B 訂單則會傳回 true。請搭配 B2B 變數使用此屬性,以在電子郵件中顯示相關資訊,例如公司名稱、公司地址與地址。舉例來說,在 B2B 訂單上,您可以在範本中加入頁首,內含下列資訊:
{% if b2b? %}
<p> Customer: {{ customer.name }}
<p> Company: {{ company.name }}
<p> Location: {{ company_location.name }}
{% endif%}
|
company | B2B 訂單中您要銷售給的 公司。 |
company.name | B2B 訂單中的公司名稱。 |
company.id | B2B 訂單中的公司 ID。 |
company_location | B2B 訂單中公司的 地址。向您採購的公司可能擁有多個地址。 |
company_location.name | B2B 訂單中的公司地址名稱。 |
company_location.id | B2B 訂單中的公司地址 ID。 |
company_location.shipping_address | B2B 訂單中該公司地址的 運送地址。 |
company_location.billing_address | B2B 訂單中該公司地址的 帳單地址。 |
payment_methods | 可用來處理草稿總金額的已儲存付款方式清單。 |
payment_method.payment_instrument | 付款工具,包含已儲存付款方式的詳細資料。 |
payment_method.payment_instrument.payment_type | 所儲存的付款方式類型。例如「credit_card、apple_pay」 |
payment_method.payment_instrument.credit_card_brand | 當 `payment_type` 為「credit_card」時的卡片品牌。 |
payment_method.payment_instrument.credit_card_company | 當 `payment_type` 為「credit_card」時的卡片公司。 |
payment_method.payment_instrument.credit_card_company | 當 `payment_type` 為「credit_card」時的卡號末 4 碼。 |
付款排程屬性
| 屬性 | 說明 |
|---|---|
payment_schedule.amount_due |
付款排程需支付的金額。 您可以使用 Liquid money filter 將金額格式化為含幣別的格式。 |
payment_schedule.due_at |
付款排程的到期日。 您可以使用 Liquid 的 date filter 來設定日期格式。 |
payment_schedule.due_in_days |
若付款排程仍為到期狀態 (未付款),距離到期日的天數。 |
payment_schedule.due_later? |
若付款排程尚未付款且到期日在未來,則傳回 true。 |
payment_schedule.number_of_days_overdue? |
付款排程逾期時,自到期日起算的天數。 |
payment_schedule.overdue? |
若付款排程尚未付款且已逾到期日,則傳回 true。 |
付款狀態屬性
| 屬性 | 說明 |
|---|---|
has_pending_payment |
(布林值) 若該訂單具有待處理付款的交易,則傳回 true。 瞭解 pending payments 的詳情。 |
buyer_action_required |
(布林值) 若訂單有待處理付款的交易,且需要買家採取動作才能讓付款繼續進行,則傳回 true。當此值為 true 且該付款方式支援付款說明時, 瞭解 Liquid transaction object 的詳情。 |
套裝元件屬性
在 line_item.bundle_components 清單中的每個 bundle_component 具有下列屬性。(僅限訂單草稿)
| 屬性 | 說明 |
|---|---|
bundle_component.image_url | 套裝元件的圖片網址。 |
bundle_component.product.title | 套裝元件商品的標題。 |
bundle_component.quantity | 套裝元件的數量。 |
bundle_component.variant.title | 套裝元件子類的目前選項值名稱,並以 範例:small / red |
元件屬性
在 line_item.components 清單中的每個 component 具有下列屬性。(僅限放棄結帳)
`
| 屬性 | 說明 |
|---|---|
component.image_url | 元件的圖片網址。 |
component.product.title | 元件產品的標題。 |
component.quantity | 元件的數量。 |
component.variant.title | 元件子類的目前選項值名稱,並以 範例:small / red |
商品項目屬性
在 line_items 或 subtotal_line_items 清單中的每個 line 具有下列屬性。
| 屬性 | 說明 |
|---|---|
line.applied_discounts(POS and draft orders only) | 套用至此項目的折扣清單 (每個折扣包含 title、code、amount、savings 與 type 屬性)。 |
line.bundle_components(Draft orders only) | 此品項的 bundle components 所對應的商品項目清單。只有當此商品項目為套裝組合商品時才會傳回清單。 |
line.bundle_parent?(Draft orders only) | (布林值) 若此商品項目為套裝組合商品,則傳回 true。 |
line.components(Abandoned checkout only) | 此品項的 components 所對應的商品項目清單。 |
line.parent?(Abandoned checkout only) | (布林值) 若此商品項目包含元件,則傳回 true。 |
line.custom(Draft orders only) | (布林值) 若此品項為訂單草稿的自訂商品項目,則傳回 true。 |
line.delivery_agreement | 與此商品項目關聯的 Delivery Agreement。 |
line.grams | 單一品項的重量。 |
line.groups | 此品項的 Line item group。 |
line.image | 傳回與此商品項目關聯的圖片網址。您也可以使用 img_url filter 取得特定圖片尺寸,例如 {{ line.image | img_url: 'small' }} |
line.line_price | 該品項之價格乘上其數量。 |
line.original_line_price | 此商品項目所含品項數量的合計價格 (折扣套用前)。 |
line.final_line_price | 此商品項目中所有品項的合計價格,包含所有商品項目層級的折扣金額。 |
line.pre_tax_price | 商品項目的稅前價格乘上購買的商品項目數量。 |
line.price | 單一品項的價格。 |
line.product.metafields | 商品層級的任何中繼欄位。請使用下列語法: line.product.metafields.NAMESPACE.KEY |
line.product.title | 商品目前的名稱。 |
line.product.vendor | 此品項的廠商。 |
line.properties | 傳回此品項的自訂資訊陣列。Line item properties 由顧客在將商品加入購物車前,於產品頁面指定。 |
line.quantity | 該品項的數量。 |
line.current_quantity | 移除後品項的目前數量。 |
line.requires_shipping | (布林值) 若此品項的子類在產品頁面上已啟用實體商品設定,則傳回 true。 |
line.selling_plan_allocation | 傳回一個 selling_plan_allocation 物件,說明像 subscription 這類銷售方案如何影響商品項目。 |
line.taxable | (布林值) 若此品項的子類在產品頁面上已勾選「對此商品收稅」核取方塊,則傳回 true。 |
line.title | 銷售當下的商品名稱,接著是一個連字號與銷售當下的子類名稱。若子類名稱為「Default Title」,則不包含子類名稱。 在提供給顧客的通知中,若顧客結帳所用語言與商店預設語言不同,系統會將商品名稱與子類名稱翻譯為顧客的結帳語言。 |
line.url | 商品項目所屬子類的相對網址。相對網址不包含您的商店根網址 (mystore.myshopify.com)。 |
line.variant.barcode | 與該產品子類選項相關的條碼。 |
line.variant.compare_at_price | 與該產品子類選項相關的 比較價格。 |
line.variant.image | 產品子類選項的圖片。只有在商品項目內已為此子類指派了特定圖片時,才會傳回圖片。 |
line.variant.metafields | 子類層級的任何中繼欄位。請使用下列語法: line.variant.metafields.NAMESPACE.KEY |
line.variant.sku | 與該產品子類選項相關的存貨單位 (SKU)。 |
line.variant.title | 目前子類的選項值名稱,以 範例:small / red |
line.refunded.quantity(within refund notifications) | 要退款的品項數量。您可以使用此屬性,為訂單中的已退款品項新增識別碼。 例如: |
在通知範本中偵測 Shopify Collective 品項
Shopify Collective 標籤會在寄出訂單確認電子郵件後套用至訂單,因此在訂單確認範本中,{% if tags contains 'Shopify Collective' %} 永遠不會是 true。若要偵測 Shopify Collective 品項,請改為檢查每個商品項目的商品層級標籤:
{% assign has_collective_item = false %}
{% for line in line_items %}
{% if line.product.tags contains 'Shopify Collective' %}
{% assign has_collective_item = true %}
{% endif %}
{% endfor %}
{% if has_collective_item %}
<!-- Collective-specific content -->
{% endif %}商品項目群組的屬性
在 line_item_groups 清單中的每個 line_item_group 具有下列屬性。
| 屬性 | 說明 |
|---|---|
line_item_group.display_title | 商品項目群組的標題。 |
line_item_group.components | 隸屬於該群組的 商品項目元件 清單。 |
line_item_group.image | 商品項目群組的圖片。 |
line_item_group.product_id | 商品項目群組的產品 ID。 |
line_item_group.variant | 商品項目群組的子類物件。 |
line_item_group.variant_id | 商品項目群組的子類 ID。 |
退款的屬性
| 屬性 | 說明 |
|---|---|
amount | 退款金額。 |
refund_line_items | 要退款的 退款商品項目 清單。 |
Refund_line_item 的屬性
在 refund_line_items 清單中的每個 refund_line 具有下列屬性:
| 屬性 | 說明 |
|---|---|
refund_line.line_item | 正在退款的 line_item。可使用該 line_item 的所有屬性。 |
refund_line.quantity | 要退款的 line_item 數量。 |
出貨作業的屬性
| 屬性 | 說明 |
|---|---|
service_name | 於 設定 > 運送和配送頁面 中定義的自訂服務名稱。(僅限出貨要求) |
fulfillment.estimated_delivery_at | 依據以下任一業者提供的追蹤編號 (若有) 所計算的預估配送日期:USPS、FedEx、UPS、加拿大郵政 (僅限加拿大)。只有在使用 運送業者計算的運費 時,才會提供此屬性。 |
fulfillment.fulfillment_line_items | 要出貨的 出貨商品項目 清單。 |
fulfillment.item_count | 所有品項數量的總和。正在出貨的品項總數。 |
fulfillment.requires_shipping | (布林值) 若此要求出貨需要運送,則傳回 true。 |
fulfillment.tracking_company | 提供貨態追蹤的公司。 |
fulfillment.tracking_numbers | 追蹤編號清單。 |
fulfillment.tracking_urls | 追蹤網址清單。 |
items_to_fulfill(deprecated) | 由此特定自訂出貨服務負責出貨的 商品項目 清單。 (僅適用於要求出貨) |
items_to_fulfill_count(deprecated) | 此要求要出貨的品項總數。 (僅適用於要求出貨) |
Fulfillment_line_item 的屬性
在 fulfillment_line_items 清單中的每個 fulfillment_line 具有下列屬性。
| 屬性 | 說明 |
|---|---|
fulfillment_line.line_item | 正在出貨的 line_item。可使用該 line_item 的所有屬性。 |
fulfillment_line.quantity | 正在出貨的 line_item 數量。 |
已備妥包裹的屬性
已備妥的包裹包含標記為可供取貨的品項。
| 屬性 | 說明 |
|---|---|
item_count | 已備妥包裹內所有品項數量的總和。 |
prepared_package_line_items | 已備妥包裹的商品項目 清單。 |
Prepared_package_line_item 的屬性
在 prepared_package_line_items 清單中的每個 prepared_package_line_item 具有下列屬性。
| 屬性 | 說明 |
|---|---|
line_item | 關聯的 line_item。可使用該 line_item 的所有屬性。 |
quantity | 已標記為可供取貨的 line_item 數量。 |
配送的屬性
| 屬性 | 說明 |
|---|---|
delivery_agreements | 此訂單的所有 配送協議 清單。 |
delivery_instructions | 要與顧客分享的當地配送資訊。此資訊由您的 當地配送設定 中的 配送資訊 欄位控制。 |
consolidated_estimated_delivery_time | 要與顧客分享的訂單配送日期資訊。此資訊由您在 運送與配送 頁面中設定的 處理時間 控制。當訂單包含多種配送方式時,會顯示配送方式與日期清單。 |
has_multiple_delivery_methods | (布林值) 若訂單有多種配送方式,則會傳回 true。 |
配送協議的屬性
| 屬性 | 說明 |
|---|---|
delivery_agreement.delivery_method_type | 配送方式類型。 |
delivery_agreement.delivery_method_name | 當結帳語言與商店預設語言不同時,會將配送方式類型翻譯為買家結帳所用的語言。 |
delivery_agreement.line_item_groups | 列出此配送協議中,包含組合式商品項目元件的所有 商品項目群組。 |
delivery_agreement.line_items | 與此配送協議相關的所有 商品項目 清單。 |
折扣的屬性
折扣屬性分為兩種。
discount_applications 用來說明品項套用折扣的原因與方式。
discount_allocations 用來描述特定折扣如何影響商品項目並降低價格。您應在商品項目層級使用此屬性。
您可以組合這些屬性,於商品項目或訂單層級顯示折扣資訊。
範例
此範例會檢查商品項目是否套用折扣。若未在訂單層級套用 (all),則會顯示折扣名稱與金額。
{% if line.discount_allocations %}
{% for discount_allocation in line.discount_allocations %}
{% if discount_allocation.discount_application.target_selection != 'all' %}
{{ discount_allocation.discount_application.title | upcase }}
(-{{ discount_allocation.amount | money }})
{% endif %}
{% endfor %}
{% endif %}結果可能如下:
SPRING5 (-$5.00)Discount_allocation 屬性
在 discount_allocations 清單中的每個 discount_allocation 都具有以下屬性。
| 屬性 | 說明 |
|---|---|
discount_allocation.amount | 顧客在單一商品項目節省的金額。若要允許多組折扣代碼,必須在迴圈中使用此屬性。 |
discount_allocation.discount_application | 在商品項目上分配該金額的 discount application。 |
Discount_application 屬性
在 discount_applications 清單中的每個 discount_application 都具有以下屬性。
| 屬性 | 說明 |
|---|---|
discount_application.target_selection |
描述折扣如何選取購物車中的商品項目以套用折扣。可能的值如下:
|
discount_application.target_type | 折扣套用的項目類型 (line_item 或 shipping_line)。 |
discount_application.title | 顯示給顧客的折扣名稱。 例如:Welcome10 或 CBBWQQAKYBYY |
discount_application.total_allocated_amount | 折扣使訂單價格降低的總金額。 |
discount_application.type | 折扣的類型。可能的值:automatic、discount_code、manual 或 script。 |
discount_application.value | 折扣的數值。 |
discount_application.value_type | 折扣的數值類型。可能的值:fixed_amount 或 percentage。 |
訂閱屬性
所有訂閱電子郵件範本都可存取訂閱合約的詳情、目前的帳單週期,以及其商品項目、配送方式與付款方式。
若要編輯訂閱通知範本,請先安裝 Shopify Subscriptions app,再前往 設定 > Notifications 的 Subscriptions 區段找到該範本。
訂閱合約的帳單週期屬性
若要存取訂閱合約及其帳單週期的屬性,請使用 subscription_contract_billing_cycle 物件。
範例
{% assign contract = subscription_contract_billing_cycle %}
This contract is currently {{ contract.status }}.結果:
This contract is currently paused.屬性
| 屬性 | 說明 |
|---|---|
status |
合約狀態。 可能為 active、paused、cancelled、failed、expired、stale,
|
delivery_method |
訂閱的配送方式。 若訂閱為 service or digital product,則會回傳 nil。
|
billing_frequency | 訂閱的計費頻率。 |
delivery_frequency | 訂閱的配送頻率。 |
origin_order |
首次建立訂閱的原始訂單。 若非由 Shopify 訂單建立訂閱,則會回傳 nil。
|
customer | 訂閱的 customer。 |
line_items | 訂閱帳單週期中的 line items。 |
product_names | 訂閱帳單週期所含商品名稱的清單。 |
update_payment_method_url | 顧客可用來更新此合約付款方式的網址。 |
shipping_address |
訂閱的運送地址。 若訂閱為 service or digital product,則會回傳 nil。
|
billing_address | 訂閱的帳單地址。 |
subtotal_price | 訂閱商品項目的小計金額。 |
shipping_price | 訂閱的運費。 |
total_tax | 訂閱的稅額總計。 |
total_price | 訂閱的總金額。 |
total_discounts | 訂閱的折扣總額。 |
customer_self_serve_url | 顧客可用來自助管理其訂閱的網址。 |
billing_attempt_expected_date | 此帳單週期的結帳日期。 |
next_billing_date | 此帳單週期之後的下一個未跳過的結帳日期。 |
last_attempted_billing_date | 此帳單週期最後嘗試計費的日期。 |
days_overdue | 此帳單週期的計費逾期天數。 |
payment_instrument | 與訂閱合約關聯的 payment instrument。此付款工具用於向顧客計費。 |
訂閱合約的商品項目屬性
帳單週期中每個商品項目的屬性。請透過上層 subscription_contract_billing_cycle.line_items 屬性存取合約的商品項目屬性。
範例
{% for line_item in subscription_contract_billing_cycle.line_items %}
{{ line_item.url }}
{% endfor %}| 屬性 | 說明 |
|---|---|
url | 商品項目產品子類選項的商品詳情頁面網址。 |
requires_shipping | 該商品項目是否需要實體運送。 |
unit_price_measurement | 商品項目的 unit price measurement。 |
selling_plan_allocation | 商品項目的 selling plan allocation。 |
訂閱合約的配送方式屬性
此帳單週期所使用的配送方式屬性。您可透過父屬性 subscription_contract_billing_cycle.delivery_method 存取配送方式屬性。
範例
{% if subscription_contract_billing_cycle.delivery_method != blank %}
Delivery method: {{ subscription_contract_billing_cycle.delivery_method.title }}
{% endif %}| 屬性 | 說明 |
|---|---|
title | 與該配送方式關聯的運送選項標題。 |
type |
配送方式類型。 可能為 shipping、local 或 pick-up 之一。
|
訂閱合約付款工具屬性
關於訂閱合約所使用之付款工具的詳情。此付款工具用於向顧客計費。您可透過父屬性 subscription_contract_billing_cycle.payment_instrument 存取付款工具屬性。
範例
{% assign instrument = subscription_contract_billing_cycle.payment_instrument %}
<img src="{{ instrument.payment_type | payment_type_img_url }} " alt="{{ instrument.credit_card_company }}" />
{{ instrument.credit_card_company }} ending with {{ instrument.credit_card_last_four_digits }}| 屬性 | 說明 |
|---|---|
payment_type |
付款工具所代表的付款方式類型。 使用 payment filters 輸出圖片網址或可擴充向量圖形 (SVG)。 |
credit_card_brand | 信用卡的品牌。 |
credit_card_company | 信用卡公司的名稱。 |
credit_card_last_four_digits | 信用卡的最後 4 碼。 |
電子郵件通知屬性
| 屬性 | 說明 |
|---|---|
shop.email_logo_url | 在管理介面的 Customize email templates 區段中指定的標誌網址。 |
shop.email_logo_width | 在管理介面的 Customize email templates 區段中指定的標誌寬度 (像素)。 |
shop.email_accent_color | 在管理介面的 Customize email templates 區段中指定的強調色十六進位色碼。 |
商店抵用金屬性
包含 store credit 發放詳情的屬性。
| 屬性 | 說明 |
|---|---|
issued_store_credit.amount |
已發放的商店抵用金金額。 您可以使用 Liquid 的 money filters 來格式化此金額。 |
issued_store_credit.expires_at |
已發放的商店抵用金的到期日期與時間。 您可以使用 Liquid date filters 來格式化此數值。 |
issued_store_credit.balance_after_transaction |
發放商店抵用金後的商店抵用金帳戶餘額。 您可以使用 Liquid 的 money filters 來格式化此金額。 |
customer | 顧客物件,內含 customer 輸出的屬性。 |