Checkout Blocks 區塊支援的 Liquid 語法
Checkout Blocks 支援 Liquid 語法子集,您可以在一些可用區塊類型使用這些語法來根據變數對結帳頁面自訂內容進行個人化設定。
支援的 Liquid 變數
以下清單包含所有支援的 Liquid 變數,這些變數可用於動態內容區塊或商品項目內容區塊。某些變數只能在某些結帳頁面存取,而其他變數只能包含在特定區塊類型。
有關每個變數的特定內容,請參閱 Shopify Liquid 物件文件。
結帳頁面 Liquid 變數
以下 Liquid 變數適用於結帳頁面:
-
checkout.attributes
-
checkout.currency
-
checkout.has_selling_plan
-
checkout.item_count
-
checkout.line_items_subtotal_price
-
checkout.locale
-
checkout.market
-
checkout.metafields
-
checkout.note
-
checkout.requires_shipping
-
checkout.shipping_price
-
checkout.tax_price
-
checkout.total_price
顧客 Liquid 變數
以下 Liquid 變數適用於顧客:
-
customer.id
-
customer.b2b
-
customer.full_name
-
customer.first_name
-
customer.last_name
-
customer.email
-
customer.phone
本地化 Liquid 變數
以下 Liquid 變數適用於市場:
-
localization.market
-
localization.market.id
-
localization.market.handle
-
訂單 Liquid 變數
以下 Liquid 變數適用於訂單:
-
checkout.order.id
-
checkout.order.legacyResourceId
-
checkout.order.name
Shop Liquid 變數
以下 Liquid 變數適用於商店資訊:
-
shop.name
-
shop.url
商品項目 Liquid 變數
只能在「商品項目內容」區塊中存取商品項目變數。
以下 Liquid 變數適用於商品項目:
-
line_item.attributes
-
line_item.gift_card
-
line_item.has_selling_plan
-
line_item.line_price
-
line_item.line_level_discount_allocations
-
line_item.line_level_total_discount
-
line_item.options_with_values
-
line_item.price
-
line_item.product
-
line_item.product.is_gift_card
-
line_item.product.product_type
-
line_item.product.requires_selling_plan
-
line_item.product.tags
-
line_item.product.vendor
-
line_item.quantity
line_item.requires_shipping
line_item.sku
line_item.subtitle
line_item.title
line_item.trigger
line_item.type
-
line_item.variant
-
line_item.variant.available_for_sale
-
line_item.variant.barcode
-
line_item.variant.compare_at_price
-
line_item.variant.id
-
line_item.variant.price
-
line_item.variant.price.amount
-
line_item.variant.price.currency_code
-
-
line_item.variant.requires_shipping
-
line_item.variant.sku
-
line_item.variant.title
-
line_item.variant.unit_price
-
line_item.variant.weight
-
line_item.variant.weight_unit
-
line_item.variant_id
line_item.vendor
使用 Liquid 的程式碼片段範例
以下是 Checkout Blocks 支援的一些 Liquid 程式碼片段範例。
檢查結帳頁面是否為 B2B
只有當結帳頁面為 B2B 時,才能顯示內容。
剖析 JSON
您可以剖析 JSON 值,例如來自商品項目屬性(性質)或中繼欄位的值。
設定幣別格式
Checkout Blocks 完全支援多種幣別結帳頁面。只需透過貨幣篩選條件,即可使用啟用的幣別格式來剖析貨幣並設定其格式。這不會自動轉換貨幣。
購物車備註
您可以顯示購物車備註的值,例如購物車中輸入的值。
購物車屬性
若要顯示特定購物車屬性的值(例如配送 日期),您可以使用此程式碼片段。請務必變更配送日期鍵值, 以匹配您自己的日期。