Supported Liquid syntax for blocks in Checkout Blocks
Checkout Blocks supports a subset of Liquid syntax that you can use in several of the available block types to personalize your checkout customizations based on variables.
On this page
Supported Liquid variables
The following lists include all supported Liquid variables that can be used within a Dynamic content block or Line item content block. Some variables are accessible only on certain pages of checkout, and other variables can be included only in specific block types.
Refer to Shopify's Liquid objects documentation for specifics on each variable.
Checkout Liquid variables
The following Liquid variables are supported for the checkout:
checkout.attributes
checkout.currency
checkout.has_selling_plan
checkout.item_count
checkout.line_items_subtotal_price
checkout.locale
checkout.market
checkout.metafields
checkout.note
checkout.requires_shipping
checkout.shipping_price
checkout.tax_price
checkout.total_price
Customer Liquid variables
The following Liquid variables are supported for customers:
customer.id
customer.b2b
customer.full_name
customer.first_name
customer.last_name
customer.email
customer.phone
Localization Liquid variables
The following Liquid variables are supported for markets:
localization.market
localization.market.id
localization.market.handle
Order Liquid variables
The following Liquid variables are supported for orders:
checkout.order.id
checkout.order.legacyResourceId
checkout.order.name
Shop Liquid variables
The following Liquid variables are supported for store information:
shop.name
shop.url
Line item Liquid variables
Line item variables are accessible only within a Line item content block.
The following Liquid variables are supported for line items:
line_item.attributes
line_item.gift_card
line_item.has_selling_plan
line_item.line_price
line_item.line_level_discount_allocations
line_item.line_level_total_discount
line_item.options_with_values
line_item.price
line_item.product
line_item.product.is_gift_card
line_item.product.product_type
line_item.product.requires_selling_plan
line_item.product.tags
line_item.product.vendor
line_item.quantity
line_item.requires_shipping
line_item.sku
line_item.subtitle
line_item.title
line_item.trigger
line_item.type
line_item.variant
line_item.variant.available_for_sale
line_item.variant.barcode
line_item.variant.compare_at_price
line_item.variant.id
line_item.variant.price
line_item.variant.price.amount
line_item.variant.price.currency_code
line_item.variant.requires_shipping
line_item.variant.sku
line_item.variant.title
line_item.variant.unit_price
line_item.variant.weight
line_item.variant.weight_unit
line_item.variant_id
line_item.vendor
Examples of snippets using Liquid
The following are some example Liquid snippets supported by Checkout Blocks.
Check if checkout is B2B
You can display content only when the checkout is B2B.
{%- if customer.b2b -%}
B2B
{%- endif -%}
Parse JSON
You can parse JSON values, such as from line item attributes (properties) or metafields.
{%- assign complex_json = checkout.metafields.checkoutblocks.complex | json -%}
Format currency
Checkout Blocks fully supports multi-currency checkout. Simply pass the money filter to parse and format money using the active currency format. This doesn't automatically convert the currency.
{{ checkout.total_price | money }}
Cart note
You can display the value of the cart note, such as what was entered on the cart.
{{ checkout.note }}
Cart attributes
To display the value of a particular cart attribute, such as a delivery date, you can use this snippet. Be sure to change the key Delivery date to match your own.
{% assign delivery_date = '' %}
{% for attribute in checkout.attributes %}
{% if attribute.key == 'Delivery date' %}
{% assign delivery_date = attribute.value %}
{% endif %}
{% endfor %}
Delivery Date: {{ delivery_date }}
Display entire checkout Liquid contents
If you need to review what values exist on the checkout object, then you can using JSON filter to serialize. This should only be used for debugging purposes.
{{ checkout | json }}
Checkout metafields
You can display custom fields saved to checkout on the thank you and order status pages by referencing the checkout metafields. Learn more about accessing metafields.
Replace your-namespace
with your namespace and your-custom-field-key
with your custom field key as defined on the block:
{{ checkout.metafields.your-namespace.your-custom-field-key.value }}
Format a date
In this example, we create a date 4 days in the future (432000 seconds) and then format it.
You can return the date formatted as "02/24/2025":
{% assign future_date = "now" | date: "%s" | plus: 432000 %}
{{ future_date | date: "%m/%d/%Y" }}
Alternatively, you can format the date as "Feb 24, 2025":
{% assign future_date = "now" | date: "%s" | plus: 432000 %}
{{ future_date | date: "%b %d, %Y" }}
Learn more about formatting dates in Liquid.
Line item content customizations
The following are some example Liquid snippets you can use on Line item content blocks.
Conditionally show the compare at price
You can conditionally show a line item's compare at price using this snippet.
{%- if line_item.variant.compare_at_price.amount -%}
On sale. Originally {{ line_item.variant.compare_at_price.amount | times: line_item.quantity | money }}
{%- endif -%}
Display content based on product tags
You can conditionally display line item content based on the product tags, which are case sensitive.
{%- if line_item.product.tags contains 'final-sale' -%}
Final sale
{%- endif -%}
Line item attributes (properties)
You can iterate over line item attributes, also known as line item properties, and display information such as delivery estimates, pre-orders, and more.
{%- 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 -%}
Display the "metafield trigger" value
The following code will contain the value of the trigger.
{{ line_item.trigger }}
Show recurring total for a line item
If you need to show the recurring total for a subscription line item before one-time discounts, then you can use the line_level_total_discount
value.
{%- 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 -%}