Checkout Blocks의 블록에 대해 지원되는 Liquid 구문
Checkout Blocks는 변수를 기반으로 체크아웃 맞춤 설정을 개인화하기 위해 사용 가능한 여러 블록 유형에서 사용할 수 있는 Liquid 구문의 하위 집합을 지원합니다.
지원되는 Liquid 변수
다음 목록에는 동적 콘텐츠 블록 또는 품목 콘텐츠 블록 내에서 사용할 수 있는 모든 지원되는 Liquid 변수가 포함되어 있습니다. 일부 변수는 특정 체크아웃 페이지에서만 액세스할 수 있으며, 다른 변수는 특정 블록 유형에만 포함할 수 있습니다.
각 변수에 대한 자세한 내용은 Shopify의 Liquid 객체 설명서를 참조하십시오.
체크아웃 Liquid 변수
체크아웃에 대해 다음 Liquid 변수가 지원됩니다.
checkout.attributescheckout.currencycheckout.has_selling_plancheckout.item_countcheckout.line_items_subtotal_pricecheckout.localecheckout.marketcheckout.metafieldscheckout.notecheckout.requires_shippingcheckout.shipping_pricecheckout.tax_pricecheckout.total_price
고객 Liquid 변수
고객에 대해 다음 Liquid 변수가 지원됩니다.
customer.idcustomer.b2bcustomer.full_namecustomer.first_namecustomer.last_namecustomer.emailcustomer.phone
현지화 Liquid 변수
마켓에 대해 다음 Liquid 변수가 지원됩니다.
localization.marketlocalization.market.idlocalization.market.handle
주문 Liquid 변수
주문에 대해 다음 Liquid 변수가 지원됩니다.
checkout.order.idcheckout.order.legacyResourceIdcheckout.order.name
Shop Liquid 변수
스토어 정보에 대해 다음 Liquid 변수가 지원됩니다.
shop.nameshop.url
품목 Liquid 변수
품목 변수는 품목 콘텐츠 블록 내에서만 액세스할 수 있습니다.
품목에 지원되는 Liquid 변수는 다음과 같습니다.
line_item.attributesline_item.gift_cardline_item.has_selling_planline_item.line_priceline_item.line_level_discount_allocationsline_item.line_level_total_discountline_item.options_with_valuesline_item.priceline_item.productline_item.product.is_gift_cardline_item.product.product_typeline_item.product.requires_selling_planline_item.product.tagsline_item.product.vendor
line_item.quantityline_item.requires_shippingline_item.skuline_item.subtitleline_item.titleline_item.triggerline_item.typeline_item.variantline_item.variant.available_for_saleline_item.variant.barcodeline_item.variant.compare_at_priceline_item.variant.idline_item.variant.priceline_item.variant.price.amountline_item.variant.price.currency_code
line_item.variant.requires_shippingline_item.variant.skuline_item.variant.titleline_item.variant.unit_priceline_item.variant.weightline_item.variant.weight_unit
line_item.variant_idline_item.vendor
Liquid를 사용한 코드 조각 예시
다음은 Checkout Blocks에서 지원하는 Liquid 코드 조각 예시입니다.
체크아웃 B2B 여부 확인
체크아웃이 B2B인 경우에만 콘텐츠를 표시할 수 있습니다.
{%- if customer.b2b -%}
B2B
{%- endif -%}JSON 파싱
품목 특성(속성) 또는 메타 필드의 JSON 값 등을 파싱할 수 있습니다.
{%- assign complex_json = checkout.metafields.checkoutblocks.complex | json -%}통화 형식 지정
Checkout Blocks는 여러 통화 체크아웃을 완벽하게 지원합니다. money 필터를 전달하기만 하면 활성 통화 형식을 사용하여 금액을 파싱하고 형식을 지정할 수 있습니다. 이 기능으로 통화가 자동으로 전환되지는 않습니다.
{{ checkout.total_price | money }}카트 참고 사항
카트에 입력된 카트 참고 사항 값을 표시할 수 있습니다.
{{ checkout.note }}카트 특성
배송 날짜와 같은 특정 카트 특성의 값을 표시하려면 이 코드 조각을 사용할 수 있습니다. Delivery date 키를 자신의 키에 맞게 변경해야 합니다.
{% assign delivery_date = '' %}
{% for attribute in checkout.attributes %}
{% if attribute.key == 'Delivery date' %}
{% assign delivery_date = attribute.value %}
{% endif %}
{% endfor %}
Delivery Date: {{ delivery_date }}전체 체크아웃 Liquid 콘텐츠 표시
체크아웃 객체에 있는 값을 검토해야 하는 경우 JSON 필터를 사용하여 직렬화할 수 있습니다. 이 기능은 디버깅 목적으로만 사용해야 합니다.
{{ checkout | json }}체크아웃 메타 필드
체크아웃 메타 필드를 참조하여 감사 페이지 및 상태 페이지에 체크아웃으로 저장된 사용자 지정 필드를 표시할 수 있습니다. 메타 필드 액세스에 대해 자세히 알아보세요.
블록에 정의된 대로 your-namespace를 사용자의 네임스페이스로, your-custom-field-key를 사용자 지정 필드 키로 바꾸세요.
{{ checkout.metafields.your-namespace.your-custom-field-key.value }}날짜 형식 지정
이 예시에서는 미래 4일(432,000초) 후의 날짜를 생성한 다음 형식을 지정합니다.
날짜를 “02/24/2025” 형식으로 반환할 수 있습니다.
{% assign future_date = "now" | date: "%s" | plus: 432000 %}
{{ future_date | date: "%m/%d/%Y" }}또는 날짜를 “Feb 24, 2025” 형식으로 지정할 수도 있습니다.
{% assign future_date = "now" | date: "%s" | plus: 432000 %}
{{ future_date | date: "%b %d, %Y" }}Liquid에서 날짜 형식 지정에 대해 자세히 알아보세요.
품목 콘텐츠 맞춤 설정
다음은 품목 콘텐츠 블록에서 사용할 수 있는 Liquid 코드 조각 예시입니다.
가격 비교 조건부 표시
이 코드 조각을 사용하여 품목의 가격 비교를 조건부로 표시할 수 있습니다.
{%- if line_item.variant.compare_at_price.amount -%}
On sale. Originally {{ line_item.variant.compare_at_price.amount | times: line_item.quantity | money }}
{%- endif -%}제품 태그를 기준으로 콘텐츠 표시
제품 태그를 기준으로 품목 콘텐츠를 조건부로 표시할 수 있습니다. 제품 태그는 대/소문자를 구분합니다.
{%- if line_item.product.tags contains 'final-sale' -%}
Final sale
{%- endif -%}품목 특성(속성)
품목 속성이라고도 하는 품목 특성을 반복하여 예상 배송, 선주문 등의 정보를 표시할 수 있습니다.
{%- assign first_line_attribute = line_item.attributes | first -%}
{%- assign first_attribute_value = first_line_attribute.value | json_parse -%}
{%- assign message = first_attribute_value.message -%}
{%- if message -%}
{{ message }}
{%- endif -%}“메타 필드 트리거” 값 표시
다음 코드에는 트리거 값이 포함됩니다.
{{ line_item.trigger }}품목의 반복 총액 표시
일회성 할인 전 구독 품목의 반복 총액을 표시해야 하는 경우 line_level_total_discount 값을 사용할 수 있습니다.
{%- if line_item.line_level_total_discount > 0 and line_item.has_selling_plan -%}
Recurring total: {{ line_item.line_price | plus: line_item.line_level_total_discount | money }}
{%- endif -%}