はじめに
この記事は、Liquid オブジェクトについて日本語訳したものです。
tax_line
, template
, theme
オブジェクトをまとめていきます。
tax_line オブジェクト
tax_line
オブジェクトの属性についてみていきます。
tax_line.price
tax_line.price
は、税金の金額を返します。
この金額は、顧客の現地通貨で表示されます。money filters
のいずれかを使用して、設定した金額形式で返します。
{{ tax_line.price | money }}
¥2,500
tax_line.rate
tax_line.rate
は、税率を10進数で返します。
{{ tax_line.rate }}
0.10
tax_line.rate_percentage
tax_line.rate_percentage
は、税率をパーセンテージ形式で返します。
{{ tax_line.rate_percentage }}%
10%
tax_line.title
tax_line.title
は、税金のタイトルを返します。
{{ tax_line.title }}
GST
templete オブジェクト
templete
オブジェクトは、一握りの属性があります。
template
だけを参照すると、現在のページをレンダリングするために使用されるテンプレートの名前を返します。
<!-- page.contact.liquid template が使用される場合は -->
{{ template }}
page.contact
template.directory
template.directory
は、テンプレートの親ディレクトリの名前を返します。
親ディレクトリがtemplates/
フォルダであるテンプレートの場合はnil
を返します。
<!-- customers/login.liquid template の場合 -->
{{ template.directory }}
customers
template.name
template.name
は、テンプレートのカスタムサフィックスが存在する場合はテンプレート名を、.liquid
拡張子が存在する場合は.liquid
拡張子を除いたテンプレート名を返します。
<!-- product.alternate.liquid template の場合 -->
{{ template.name }}
product
template.suffix
template.suffix
は、template.name
プリフィックス、または.liquid
拡張子を除いたカスタムテンプレートの名前を返します。カスタムテンプレートを使用していない場合はnil
を返します。
<!-- product.alternate.liquid template の場合 -->
{{ template.suffix }}
alternate
theme オブジェクト
theme
オブジェクトには、ストアの公開テーマに関する情報が含まれています。
theme
オブジェクトの属性についてみてみます。
theme.id
theme.id
は、テーマのIDを返します。これは、ユーザーをテーマエディタに直接リンクさせたい場合に便利です。
Visit the <a href="/admin/themes/{{ theme.id }}/settings">theme editor</a> to change your logo.
Visit the <a href="/admin/themes/8196497/settings">theme editor</a> to change your logo.
theme.name
theme.name
は、テーマの名前を返します。
終わりに
今回の記事はここまでになります。
お疲れ様でした。
Shopify アプリのご紹介
Shopify アプリである、「商品ページ発売予告アプリ | リテリア Coming Soon」は、商品ページを買えない状態のまま、発売日時の予告をすることができるアプリです。Shopify で Coming Soon 機能を実現することができます。