Shopify Order Printer用のLiquid変数と絞り込みに関するリファレンス
Shopify Order Printerアプリで、Liquidを使用してカスタムテンプレートを作成できます。Liquidを使用することにより、テキストテンプレートを作成し、各注文の固有データに基づいてそれらを処理できます。
このページのLiquidリファレンスは、Liquidのオープンソースバージョンの拡張機能で、Shopify Order Printerアプリでの使用を意図されています。order
属性およびshop
属性に基づいて情報をレンダリングするには、このリファレンスのオブジェクト、タグ、絞り込みのリストを使用して、テンプレートをカスタマイズできます。Admin GraphQL APIドキュメントで、オブジェクトフィールドの詳細を確認することもできます。
変数と属性を使用する
Shopify Order Printerのテンプレートでのコアデータオブジェクトは、order
とshop
です。注文属性にアクセスするには、order.variable_name
を使用できます。
以下の一般的に使用される注文属性は、order.
プリフィックスなしでアクセスできます。
line_items
tax_lines
fulfillments
transactions
discounts
refunds
shipping_methods
customer
たとえば、項目変数にアクセスする場合は、line_items
またはorder.line_items
を使用できます。
Shopify Order Printerで利用可能なLiquid変数
以下は利用可能なクラスです。属性はアルファベット順で記載されています。
注文する
以下は、Shopify Order Printerで利用可能なOrder属性です。
attributes
b2b
billing_address
cancel_reason
cancel_reason_label
cancelled
cancelled_at
cart_level_discount_applications
checkout_id
checkout_payment_collection_url
company
company_location
confirmation_number
created_at
注文が処理された時間。これは、GraphQL APIのorder.processed_at
と等しくなります。date
フィルターを使用して、タイムスタンプの書式を設定できます (例:{{ order.created_at | date: "%B %e, %Y" }}
)。customer
discounts
すべてのディスカウントタイプと詳細情報が取得されるわけではないため、廃止になりました。order.discounts
プロパティはorder.discount_applications
に変更となりました。discounts_amount
すべてのディスカウントタイプと詳細情報が取得されるわけではないため、廃止になりました。order.discounts
プロパティはorder.total_discounts
に変更となりました。discount_applications
discounts_savings
すべてのディスカウントタイプと詳細情報が取得されるわけではないため、廃止になりました。order.discounts
プロパティは-
に変更となりました。email
fees
financial_status
financial_status_label
fulfilled_line_items
fulfillment_aborted
fulfillment_status
fulfillments
gateway
id
item_count
landing_site
landing_site_ref
line_items
line_items_subtotal_price
location
metafields
name
net_payment
note
order_name
order_number
order_status_url
payment
payment_details
po_number
refunds
requires_shipping
shipping_address
shipping_method
shipping_methods
shipping_price
shop
shop_name
subtotal_price
tags
tax_lines
tax_price
tip_line_items
total_discounts
total_duties
total_landed_cost_additional_fees
total_net_amount
total_outstanding
total_price
total_refunded_amount
total_tip
transactions
unacceptable_risks
unfulfilled_line_items
unique_gateways
user
void_transactions
ショップ
Shopify Order Printerで利用可能なShop属性については、以下のリストをご覧ください。
accepts_gift_cards
account_owner
allows_discounts
checkout
checkout_requires_confirmation_step
collections_count
contact_information
currency
customer_accounts_enabled
customer_accounts_optional
description
domain
email
email_accent_color
email_logo_url
email_logo_width
email_marketing
enabled_currencies
enabled_locales
enabled_payment_types
features
id
latitude
legal_notice
longitude
metafields
money_format
money_with_currency_format
name
password_message
permanent_domain
phone
policies
privacy_policy
products_count
refund_policy
secure_url
shipping_policy
subscription_policy
terms_of_sale
terms_of_service
types
url
項目
Shopify Order Printerで利用可能なLine Item属性については、以下のリストをご覧ください。
aggregated_update
applied_discounts
すべてのディスカウントタイプと詳細情報が利用できるわけではないため、廃止になりました。line_item.discounts
プロパティはline_item.discount_allocations
に変更となりました。current_quantity
discount_allocations
discounts
すべてのディスカウントタイプと詳細情報が利用できるわけではないため、廃止になりました。line_item.discounts
プロパティはline_item.discount_allocations
に変更となりました。final_line_price
final_price
fulfillment
fulfillment_service
gift_card
grams
groups
id
image
index
item_updates
json_filter
key
line_level_discount_allocations
line_level_total_discount
line_price
自動ディスカウントとクーポンコードからのディスカウントが追加されないため、廃止になりました。line_item.line_price
プロパティはline_item.final_line_price
に変更となりました。message
options_with_values
original_line_price
original_price
price
自動ディスカウントとクーポンコードからのディスカウントが追加されないため、廃止になりました。line_item.price
プロパティはline_item.final_price
に変更となりました。product
product_id
properties
quantity
refunded_quantity
requires_shipping
selling_plan_allocation
sku
successfully_fulfilled_quantity
tax_lines
taxable
title
total_discount
自動ディスカウントとクーポンコードからのディスカウントが追加されないため、廃止になりました。line_item.total_discount
プロパティはline_item.line_level_total_discount
に変更となりました。unit_price
unit_price_measurement
url
url_to_remove
variant
variant_id
vendor
フルフィルメント
Shopify Order Printerで利用可能なFulfillment属性については、以下のリストをご覧ください。
created_at``date
フィルターを使用して、タイムスタンプの書式を設定できます (例:{{ fulfillment.created_at | date: "%B %e, %Y" }}
)。estimated_delivery_at
fulfillment_line_items
item_count
line_items
requires_shipping
tracking_company
tracking_number
tracking_numbers
tracking_url
tracking_urls
updated_at
住所
以下は、Shopify Order Printerで利用可能なAddress属性です。
address1
address2
city
company
country
country_code
country_upper
errors
first_name
id
last_name
name
phone
province
province_code
street
summary
translated_country_name
translated_province_name
url
zip
お客様
Shopify Order Printerで利用可能なCustomer属性については、以下のリストをご覧ください。
accepts_marketing
account_activation_url
addresses
addresses_count
b2b?
default_address
email
first_name
has_account
id
last_name
last_order
metafields
name
new_address
orders
orders_count
payment_methods
phone
reset_password_url
subscribe_url
tags
tax_exempt
total_spent
DiscountApplication
Shopify Order Printerで利用可能なDiscountApplicationについては、以下のリストをご覧ください。
target_selection
target_type
title
total_allocated_amount
type
value_type
value
ディスカウントの印刷
以下に挙げるように、ディスカウントは、注文全体または特定の項目に適用できます。
- 注文レベルのディスカウント:注文全体に適用されます。注文の請求書を印刷するときに、これらのディスカウントを下部に個別に表示することができます。
- 項目レベルのディスカウント:個々のアイテムに適用されます。項目セクションで個々のアイテムの詳細を印刷するときに、これらのディスカウントに関して記載することができます。
以下の変数を使用して、ディスカウント情報にアクセスできます。
注文または項目に適用されるディスカウントすべての
order.total_discounts
値とorder.discount_applications
コレクションにアクセスします。line_item.line_level_total_discount
値またはline_item.line_level_discount_allocations
コレクションに関する項目のディスカウントにアクセスします。line_item.original_price
値にディスカウントを適用する前の項目の価格にアクセスします。 -line_item.final_price
値に関連する項目レベルのディスカウントすべてを適用した後の、項目の最終価格にアクセスします。 -line_item.original_line_price
およびline_item.final_line_price
値は、line_item.original_price
とline_item.final_price
値をline_item.quantity
乗算した値と等しくなります。order.cart_level_discount_applications
コレクションで注文レベルのディスカウントにアクセスします。
項目レベルのディスカウントを印刷するコードブロックの例:
{% for line_item in order.line_items %}
<tr>
<td>{{ line_item.quantity }}</td>
<td>{{ line_item.title }}
{% if line_item.line_level_discount_allocations.size > 0 %}
<span class="subduedText">
{% for discount_allocation in line_item.line_level_discount_allocations %}
<br>{{ discount_allocation.discount_application.title }} (-{{ discount_allocation.amount | money }})
{% endfor %}
</span>
{% endif %}
</td>
<td style="text-align: right;">
{% if line_item.original_price != line_item.final_price %}
<span class="subduedText"><s>{{ line_item.original_price | money }}</s></span>
{% endif %}
{{ line_item.final_price | money }}
</td>
</tr>
{% endfor %}
注文レベルのディスカウントを印刷するコードブロックの例:
{% for discount_application in order.cart_level_discount_applications %}
<tr>
<td colspan="2" style="text-align: right;">{% if discount_application.title %}<span class="subduedText">{{ discount_application.title }}</span>{% endif %}</td>
<td style="text-align: right;">-{{ discount_application.total_allocated_amount | money }}</td>
</tr>
{% endfor %}
- ディスカウントのタイプとLiquidでディスカウントを設定する方法について詳しくは、ご覧ください。
DiscountAllocation
Shopify Order Printerで利用可能なDiscountAllocation属性については、以下のリストをご覧ください。
amount
discount_application
割引
Shopify Order Printerで利用可能なDiscount属性については、以下のリストをご覧ください。
amount
code
free_shipping_discount
id
savings
title
total_amount
total_savings
商品
Shopify Order Printerで利用可能なProduct属性については、以下のリストをご覧ください。
as_json
available
collections
compare_at_price
compare_at_price_max
compare_at_price_min
compare_at_price_varies
content
created_at
description
featured_image
featured_media
first_available_variant
gift_card?
handle
has_only_default_variant
id
images
json_filter
media
metafields
object_type
options
options_by_name
options_with_values
price
price_max
price_min
price_varies
published_at
requires_selling_plan
selected_or_first_available_selling_plan_allocation
selected_or_first_available_variant
selected_selling_plan
selected_selling_plan_allocation
selected_variant
selling_plan_groups
tags
template_suffix
title
type
url
variants
vendor
バリエーション
Shopify Order Printerで利用可能なVariant属性については、以下のリストをご覧ください。
as_json
available
barcode
compare_at_price
featured_image
featured_media
id
image
incoming
inventory_management
inventory_policy
inventory_quantity
json_filter
metafields
next_incoming_date
option1
option2
option3
options
price
product
requires_selling_plan
requires_shipping
selected_selling_plan_allocation
selling_plan_allocations
sku
store_availabilities
taxable
title
unit_price
unit_price_measurement
url
weight
weight_in_unit
weight_unit
返金
Shopify Order Printerで利用可能なRefund属性については、以下のリストをご覧ください。
amount
created_at
id
note
refund_line_items
restock
transactions
ShippingLine
Shopify Order Printerで利用可能なShipping Line属性については、以下のリストをご覧ください。
handle
id
original_price
price
価格に注文レベルのディスカウントが追加されないため、廃止になりました。shipping_line.price
プロパティはshipping_line.price_with_discounts
に変更となりました。price_with_discounts
tax_lines
title
TaxLine
Shopify Order Printerで利用可能なTax Line属性については、以下のリストをご覧ください。
price
rate
rate_percentage
title
取引
Shopify Order Printerで利用可能なTransaction属性については、以下のリストをご覧ください。
amount
buyer_pending_payment_instructions
buyer_pending_payment_notice
created_at
gateway
gateway_display_name
id
kind
name
payment_details
receipt
show_buyer_pending_payment_instructions
status
status_label
メタフィールド
親オブジェクトに関連付けられているメタフィールドです。特定オブジェクトのメタフィールドにアクセスする方法については、「メタフィールドにアクセスする」を参照してください。
メタフィールドは複数のデータタイプに対応しており、これによりメタフィールドに格納される情報の種類が決まります。メタフィールドにアクセスするため、メタフィールドのアクセスパスは以下の2種類のレイヤーで構成されています。
- namespace - 競合を防止するためにメタフィールドをグループ化します。
- key - メタフィールドの名前です。
これを踏まえると、{{ resource.metafields.namespace.key }}
という構文を使用してmetafieldオブジェクトにアクセスできます。
名前は<object>.metafields.<namespace>.<key>
になります。order.metafields.shipping.express_delivery_status
のようにキャンペーン名を入力します。
タイプ
String
Array
:[]
をインデックスとして使用します。例:order.metafield.shipping.express_delivery_status[0]
Integer
Boolean
Date
メモMetaobject
タイプには対応していません。
メタフィールドに対応するオブジェクト
Order
Customer
Product
Variant
Location
Shopify Order Printerで利用可能なLiquidフィルター
用途
出力に絞り込みを適用するには、絞り込みと絞り込みパラメーターを出力の中括弧区切り文字{{ }}
内に追加し、その前にパイプ文字「|
」を付けます。以下の例において、productはオブジェクト、titleはそのプロパティであり、upcaseは適用される絞り込みです。
{{ product.title | upcase }}
product.title
にHealth potion
値がある場合、HEALTH POTION
は絞り込みupcase
からの出力となります。
「Shopify Themes Liquid」リファレンスの「絞り込み」セクションで、Liquidフィルターの詳しい使用方法を確認してください。
Addressオブジェクトに適用される絞り込み
format_address
使用例については、「Shopify Themes Liquid」ドキュメントでformat_addressについて参照してください。
任意のテキスト/文字列に適用される絞り込み
camelcase
camelize
encode_url_component
format_code
handle
highlight
pad_spaces
paragraphize
pluralize
url_escape
url_param_escape
使用例については、「Shopify Themes Liquid」ドキュメントで文字列の絞り込みに関するセクションを参照してください。
金額を意味する数字に適用される絞り込み
money
money_with_currency
money_without_currency
money_without_trailing_zeros
Shopify Order Printerでは、管理画面で設定したメール通知の通貨フォーマットオプションが、資金のフォーマットに使用されます。通貨のフォーマットを変更することができます。管理画面で、Email with currency
とEmail without currency
の値を設定して、Shopify Order Printerの資金絞り込みのフォーマットを変更します。
使用例については、「Shopify Themes Liquid」ドキュメントで資金絞り込みについて参照してください。
オブジェクトをjsonに変換するために適用される絞り込み
json
使用例については、「Shopify Themes Liquid」ドキュメントでJSONフィルターについて参照してください。
重みを意味する番号に適用されるフィルター
weight
weight_with_unit
使用例については、「Shopify Themes Liquid」ドキュメントで単位付きの重さに関するセクションを参照してください。
タグに適用されるフィルター
highlight_active_tag
link_to_add_tag
link_to_remove_tag
link_to_tag
使用例については、「Shopify Themes Liquid」ドキュメントでタグの絞り込みについて参照してください。
URLに適用される絞り込み
article_img_url
asset_img_url
asset_url
cdn_asset_url
collection_img_url
file_img_url
file_url
global_asset_url
image_url
img_tag
img_url
link_to
payment_icon_png_url
payment_type_img_url
payment_type_svg_tag
placeholder_svg_tag
product_img_url
script_tag
shopify_asset_url
stylesheet_tag
使用例については、「Shopify Themes Liquid」ドキュメントでメディアとHTMLの絞り込みに関するセクションを参照してください。
コレクションに適用される絞り込み
link_to_type
link_to_vendor
sort_by
url_for_type
url_for_vendor
within
使用例については、「Shopify Themes Liquid」ドキュメントでコレクションの絞り込みについて参照してください。