> ## 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.

# テンプレートでの金額と通貨

> FoliantのLiquidでは、金額はセント単位です。金額フィルターを使って、注文の通貨または別の通貨で出力します。

FoliantのLiquidでは、すべての金額はセント単位の整数です。注文合計が100.00の場合は`10000`になります。これはShopify Order Printerと同じため、既存のテンプレートでも同じ金額が出力されます。金額を出力するときは、必ず金額フィルターを使ってください。フィルターが100で割り、通貨を付けます。

## 金額フィルター

| フィルター | 例 | 出力（ストアの形式 `${{amount}}`） |
| - | - | - |
| `money` | `{{ total_price \| money }}` | `$1,604.20` |
| `money_with_currency` | `{{ total_price \| money_with_currency }}` | `$1,604.20 USD` |
| `money_without_currency` | `{{ total_price \| money_without_currency }}` | `1,604.20` |
| `money_without_trailing_zeros` | `{{ 10000 \| money_without_trailing_zeros }}` | `$100` |
| `money_in` | `{{ amount \| money_in: 'EUR' }}` | 指定した通貨での金額 |

* `money`、`money_with_currency`、`money_without_currency`、`money_without_trailing_zeros`は**注文の通貨**を使います。そのため、カナダドルで支払われた注文はCADで出力されます。
* `money_in`は、注文とは別の通貨で金額を出力します。たとえば、自国通貨でのVATは次のように出力します：`{{ vat_reporting.tax | money_in: vat_reporting.currency }}`。

## 金額の出力形式

金額の表示は、テンプレートの**数値の形式**で決まります。この設定は、エディターの上部またはテンプレートの設定ページにあります。

| 数値の形式 | 内容 |
| - | - |
| **ストアの通貨形式** | Shopify Order Printerと同様に、Shopify管理画面で設定したストアの通貨形式を使います。 |
| **ドキュメントの言語の形式** | ドキュメントの言語の書き方で金額を表示します。たとえば、ドイツ語では`1.234,56 €`になります。 |

`format_number`は常にドキュメントの言語の区切り文字を使います。ドイツ語のドキュメントでは、`{{ 1234.5 | format_number: 2 }}`は`1.234,50`と出力されます。

## 計算はセント単位で行う

金額はセント単位のため、先に計算し、最後に形式を整えます。

```liquid theme={null}
{% assign balance = total_price | minus: total_paid %}
{% if balance > 0 %}
  {{ 'total_due' | t }}: {{ balance | money }}
{% endif %}
```

金額の比較もセント単位で行います。`{% if total_price >= 10000 %}`は100.00以上を意味します。

## 補足

* 金額フィルターは、通貨ごとに正しい桁数の小数を出力します。小数点以下3桁の通貨（KWDなど）は3桁のまま出力されます。
* 金額タイプのメタフィールドはセント単位ではありません。`value`（`23.00`など）と`unit`（通貨コード）を持ちます。[テンプレートでのメタフィールド](https://foliant-help.iforiti.com/jp/template-editor/metafields.md)をご覧ください。
* 商品の価格は、商品ごとの割引を適用した後の金額です。注文全体の割引は`order_level_discounts`にあります。[テンプレートでの商品](https://foliant-help.iforiti.com/jp/template-editor/liquid-line-items.md)をご覧ください。

## 関連記事

* [注文オブジェクトとよく使う変数](https://foliant-help.iforiti.com/jp/template-editor/liquid-order-variables.md)
* [Liquidフィルター](https://foliant-help.iforiti.com/jp/template-editor/liquid-filters.md)
* [日付、言語、翻訳](https://foliant-help.iforiti.com/jp/template-editor/liquid-dates-and-languages.md)
* [Liquidでの条件付きコンテンツ](https://foliant-help.iforiti.com/jp/template-editor/liquid-conditional-content.md)


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