> ## 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의 조건부 콘텐츠

> if, unless, case를 사용해 일부 주문에만 템플릿의 일부를 인쇄하는 방법과 Liquid가 지원하는 비교 연산을 알아봅니다.

Liquid를 사용하면 어떤 조건이 참일 때만 템플릿의 일부를 인쇄할 수 있습니다. 결제된 주문에는 "결제 완료" 스탬프를, 선물 메시지가 있으면 선물 메시지를, 해외 배송 주문에는 세관 정보를 인쇄하는 식입니다. 비주얼 편집기에서는 블록의 **표시 조건** 탭을 대신 사용하세요([일부 주문에만 블록 표시하기](https://foliant-help.iforiti.com/ko/template-editor/block-conditions.md) 참조). 이 문서는 코드 템플릿, **사용자 지정 Liquid** 블록, 블록의 **Liquid 조건** 옵션에 관한 내용입니다.

## if, elsif, else

```liquid theme={null}
{% if financial_status == 'paid' %}
  <p class="stamp">PAID</p>
{% elsif financial_status == 'partially_paid' %}
  <p>Partly paid. {{ 'total_due' | t }}: {{ total_price | minus: total_paid | money }}</p>
{% else %}
  <p>Payment pending</p>
{% endif %}
```

## unless

`unless`는 `if`의 반대입니다.

```liquid theme={null}
{% unless customer.tax_exempt %}
  {% include 'vat_breakdown' %}
{% endunless %}
```

## case

```liquid theme={null}
{% case shipping_address.country_code %}
  {% when 'US', 'CA' %}
    <p>Ships within North America</p>
  {% when 'GB' %}
    <p>Ships within the UK</p>
  {% else %}
    <p>International shipment</p>
{% endcase %}
```

## 비교 연산

| 연산자 | 의미 | 예시 |
| - | - | - |
| `==` / `!=` | 같음 / 같지 않음 | `fulfillment_status == 'fulfilled'` |
| `>` `<` `>=` `<=` | 초과 / 미만 | `total_price >= 10000` |
| `contains` | 텍스트에 포함되거나 목록에 들어 있음 | `tags contains 'Wholesale'` |
| `and` / `or` | 조건 결합 | `pickup_in_store? or shipping_lines.size == 0` |
| `blank` | 비어 있거나 없음 | `note != blank` |

Liquid는 `and`와 `or`를 오른쪽에서 왼쪽으로 읽으며 괄호를 지원하지 않습니다. 복잡한 규칙에는 `if` 태그를 중첩해서 사용하세요.

## 자주 쓰는 예시

주문에 메모가 있을 때만:

```liquid theme={null}
{% if note != blank %}<p>{{ note | escape }}</p>{% endif %}
```

100.00 이상 주문에만(금액은 센트 단위입니다):

```liquid theme={null}
{% if total_price >= 10000 %}<p>Free gift included</p>{% endif %}
```

VIP 태그가 있는 고객에게만:

```liquid theme={null}
{% if customer.tags contains 'VIP' %}<p>Thank you for being a VIP!</p>{% endif %}
```

EU 외 지역으로 배송하는 주문에만:

```liquid theme={null}
{% unless shipping_address.member_of_eu %}…customs details…{% endunless %}
```

임시 주문에만:

```liquid theme={null}
{% if is_draft_order? %}…{% endif %}
```

## 비주얼 블록의 Liquid 조건

블록의 **Liquid 조건**은 `{% if … %}` 안에 들어가는 부분으로, 태그 없이 하나의 표현식만 입력합니다. 예: `total_price >= 10000 and customer.tags contains 'VIP'`. Foliant는 입력하는 동안 샘플 주문을 기준으로 조건을 확인하고, Liquid가 읽을 수 없으면 알려 줍니다.

## 참고 사항

* 텍스트 비교는 대소문자를 구분합니다. `'vip'`는 `'VIP'`와 일치하지 않습니다. 비주얼 편집기에서 **텍스트 포함**을 사용하는 태그 조건은 대소문자를 구분하지 않습니다.
* `financial_status`와 `fulfillment_status` 값은 밑줄이 들어간 소문자입니다: `paid`, `partially_refunded`, `unfulfilled`, `partially_fulfilled`.
* 미리 보기 주문 선택기에서 **샘플 주문**과 최근 주문으로 조건을 확인하세요. [미리 보기, 용지 크기, 확대/축소](https://foliant-help.iforiti.com/ko/template-editor/preview-paper-and-zoom.md)를 참조하세요.

## 관련 문서

* [일부 주문에만 블록 표시하기](https://foliant-help.iforiti.com/ko/template-editor/block-conditions.md)
* [주문 객체와 자주 쓰는 변수](https://foliant-help.iforiti.com/ko/template-editor/liquid-order-variables.md)
* [템플릿의 금액과 통화](https://foliant-help.iforiti.com/ko/template-editor/liquid-money-and-currency.md)
* [템플릿 코드 편집하기](https://foliant-help.iforiti.com/ko/template-editor/code-editor.md)


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