> ## Documentation Index
> Fetch the complete documentation index at: https://foliant-help.iforiti.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 注文オブジェクトとよく使う変数

> 注文、顧客、住所、ショップ、配送、支払い、返金、フルフィルメントについて、テンプレートで使うLiquid変数を説明します。

すべての書類は1件の注文（一括テンプレートの場合は選択した注文）から作成されます。Liquidでは、注文のフィールドを `{{ name }}` のように直接使えるほか、`{{ order.name }}` のように `order` の下からも使えます。どちらも同じように動作します。変数はShopifyのOrder Printerに準拠しているため、ほとんどのOrder PrinterテンプレートはFoliantでもそのまま使えます。

コードエディタの **Liquid変数** タブに、すべての変数が検索機能付きで一覧表示されます。この記事では、よく使う変数を紹介します。金額の値はセント単位です。[テンプレートでの金額と通貨](https://foliant-help.iforiti.com/jp/template-editor/liquid-money-and-currency.md)をご覧ください。

## 注文

| 変数 | 出力内容 |
| - | - |
| `{{ order_name }}` または `{{ name }}` | #付きの注文名（`#1042`） |
| `{{ order_number }}` | 注文番号（`1042`） |
| `{{ id }}` | 注文ID |
| `{{ po_number }}` | 発注番号 |
| `{{ date }}` または `{{ created_at }}` | 注文日時。`date` フィルターで書式を設定します。 |
| `{{ processed_at }}`、`{{ updated_at }}`、`{{ cancelled_at }}`、`{{ closed_at }}` | その他の注文日時 |
| `{{ completed_at }}` | 下書き注文が完了した日時 |
| `{{ financial_status }}` | 支払いステータス（`paid`、`pending`、`partially_refunded` など） |
| `{{ fulfillment_status }}` | フルフィルメントステータス（`unfulfilled`、`fulfilled` など） |
| `{{ note }}` | 注文メモ |
| `{{ tags }}` | 注文のタグ（リストです。`{% for tag in tags %}` でループします） |
| `{{ email }}` | 注文のメールアドレス |
| `{{ customer_locale }}` | 顧客が買い物をした言語 |
| `{{ order_status_url }}` | 注文状況ページのリンク（オンライン注文） |
| `{{ total_items }}` または `{{ item_count }}` | 商品の数 |
| `{{ total_weight }}` | 総重量。`{{ total_weight_in_grams \| weight_with_unit }}` で単位が付きます |
| `{{ order_currency }}` または `{{ currency }}` | 注文の通貨コード |
| `{% if pickup_in_store? %}…{% endif %}` | 店舗受け取りの注文かどうか |
| `{{ location.name }}` | POSのロケーション（POS注文）。`address1`、`city`、`zip`、`country`、`phone`… も使えます |

## 合計

合計は金額フィルターを使って出力します。例: `{{ total_price | money }}`。

| 変数 | 内容 |
| - | - |
| `subtotal_price` | 小計 |
| `shipping_price` | 配送料 |
| `total_discounts` | すべての割引 |
| `order_level_discounts` | 注文全体の割引（商品価格に含まれないもの） |
| `total_tax` | 税金 |
| `total_line_items_tax`、`total_shipping_tax` | 商品にかかる税金と、配送料にかかる税金 |
| `total_duties` | 関税 |
| `total_price` | 注文合計 |
| `total_paid` | 支払い済みの金額 |
| `total_refunds` | 返金された金額 |
| `total_gift_cards` | ギフトカードで支払われた金額 |

`current_subtotal_price`、`current_total_discounts`、`current_total_tax`、`current_total_price` も使えます。

## 顧客と住所

| 変数 | 出力内容 |
| - | - |
| `{{ customer.name }}`、`{{ customer.first_name }}`、`{{ customer.last_name }}` | 顧客の名前 |
| `{{ customer.email }}`、`{{ customer.phone }}` | 連絡先 |
| `{{ customer.note }}` | 顧客メモ |
| `{{ customer.tags }}` | 顧客のタグ |
| `{{ customer.total_spent \| money }}` | 顧客の購入金額 |
| `{% if customer.tax_exempt %}` | 顧客が免税かどうか |
| `{{ shipping_address \| format_address }}` | 改行付きで整形された配送先住所 |
| `{{ billing_address \| format_address }}` | 請求先住所 |

各住所（`shipping_address`、`billing_address`、`customer.default_address`）には、`name`、`first_name`、`last_name`、`company`、`address1`、`address2`、`street`、`city`、`province`、`province_code`、`zip`、`country`、`country_code`、`phone`、`city_province_zip` があります。`{% if shipping_address.member_of_eu %}` で、国がEU加盟国かどうかを確認できます。

## ショップ

| 変数 | 出力内容 |
| - | - |
| `{{ shop.name }}` または `{{ shop_name }}` | ショップ名 |
| `{{ shop.email }}`、`{{ shop.phone }}`、`{{ shop.domain }}` | 連絡先 |
| `{{ shop.address1 }}`、`{{ shop.city }}`、`{{ shop.zip }}`、`{{ shop.country }}`… | Shopifyで設定した住所 |
| `{{ shop_logo_url }}`、`{{ shop_logo_width }}`、`{{ shop_accent_color }}` | **設定 › ブランディング** で設定したロゴとアクセントカラー |
| `{{ shop.vat_number }}`、`{{ shop.eori }}` | **設定 › 税金・法的情報** で設定したVAT番号とEORI |
| `{{ seller.legal_lines \| join: ' · ' }}` | 書類の言語で1行ずつ表示される法的情報 |

## 配送、支払い、フルフィルメント

| 変数 | 出力内容 |
| - | - |
| `{{ shipping_method.title }}` | 配送方法 |
| `{% for shipping_line in shipping_lines %}` | 各配送明細: `title`、`code`、`price` |
| `{{ payment_method }}`、`{{ gateway }}` | 注文の支払い方法 |
| `{% for transaction in transactions %}` | 各取引: `amount`、`kind`、`status`、`gateway`、`created_at` |
| `{% for tax_line in tax_lines %}` | 各税金: `title`、`rate`、`price` |
| `{% for discount in discounts %}` | 各割引: `code`、`amount`、`savings` |
| `{% for fulfillment in fulfillments %}` | 各フルフィルメント: `tracking_number`、`tracking_company`、`created_at` |
| `{{ latest_fulfillment }}` | 最新のフルフィルメント |
| `{% for refund in refunds %}` | 各返金: `created_at`、`note`、`subtotal`、`total_tax`、`total`、`refund_line_items` |
| `{{ latest_refund }}` | 最新の返金（クレジットノート） |
| `{{ payment_terms.due_in_days }}` | 支払い条件（B2Bと下書き注文）。`payment_schedules` と `current_payment_schedule.due_at` も使えます |

## 例

```liquid theme={null}
<h1>{{ 'titles.invoice' | t }} {{ order_name }}</h1>
<p>{{ created_at | date: '%d %B %Y' }}</p>
<p>{{ shipping_address | format_address }}</p>
<p>{{ 'total' | t }}: {{ total_price | money }}</p>
{% if note != blank %}<p>{{ note | escape }}</p>{% endif %}
```

## 補足

* 値が空の場合は何も出力されません。値がないときにラベルを表示しないようにするには、`{% if … != blank %}` を使います。
* 選択したすべての注文を対象とするテンプレートでは、1件の注文の代わりに `orders`（`{% for order in orders %}` でループします）、`batch`、`pick_list` を使います。**Liquid変数** タブの **一括テンプレート** セクションをご覧ください。
* 消費税（VAT）の請求書については、リファレンスの **消費税（VAT）** セクションにある `tax_breakdown`、`buyer.vat_number`、`{% include 'vat_breakdown' %}`、`{% include 'legal_notes' %}` をご覧ください。[税金と法的情報](https://foliant-help.iforiti.com/jp/tax-and-legal.md)もご覧ください。

## 関連記事

* [テンプレートでの商品明細](https://foliant-help.iforiti.com/jp/template-editor/liquid-line-items.md)
* [テンプレートでの金額と通貨](https://foliant-help.iforiti.com/jp/template-editor/liquid-money-and-currency.md)
* [Liquidフィルター](https://foliant-help.iforiti.com/jp/template-editor/liquid-filters.md)
* [テンプレートのコードを編集する](https://foliant-help.iforiti.com/jp/template-editor/code-editor.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.