Skip to content

Dynamic text

Most text fields in Checkout Buddy blocks can do more than show plain text. They can:

  • Show live checkout values, like how much more the customer needs to spend for free shipping.
  • Format text: bold, red, gray, strikethrough, small, discount badges.
  • Add links and tooltips.

Fields that support this say so in their help text, for example “This field supports variables, links, and bolded text.”

A progress bar block reading ‘You’re $45.00 away from free shipping’, calculated from the cart subtotal

Put anything you want calculated between double curly brackets, {{ }}. Everything else is shown as written.

Amount left for free shipping, for a free shipping threshold of 75:

You're {{ toMoney(75 - orderSubtotal, currencyCode) }} away from free shipping.

A link and bold text:

**Free returns** within 30 days. [Read our returns policy](https://example.com/returns)

Show the SKU under a line item, only when there is one:

{{ variantSku && variantSku !== 'undefined' ? `SKU: ${variantSku}` : '' }}

Dynamic text combines two things:

  • Variables and expressions inside {{ }}. The part between the brackets is a small piece of JavaScript: you can do math, compare values, and choose between texts. See variables.
  • Formatting such as **bold**, [links](https://…) and {@red text}. See formatting.

Expressions run first, so an expression can output formatting:

{{ orderSubtotal > 75 ? '**You get free shipping!**' : 'Free shipping over $75' }}
Block Fields What’s supported
Text Subheading, body Variables and formatting
Banner Body Variables and formatting
Banner Title Variables only; formatting shows as typed
Line item text Text Line item variables and formatting. No cart totals.
Trust badges, Icons with text, FAQ, Contact info, Feature highlights Body text, labels, questions, answers Cart variables and formatting
Upsell / Cross sell, Discount buttons, Checkbox product offer Body text, text under each product, offer descriptions Cart variables and formatting. Button labels are plain text.
Order note Checkbox label Cart variables and formatting
Progress bars In progress and complete text Cart variables and formatting. The weight bar only has totalWeight.
Multiple checkboxes, Radio, Checkbox Question and option labels Cart variables and formatting
Checkbox, SMS consent The checkbox’s own label Links only
Text field, Text area, Select, Date, Phone Labels Plain text only
Image Subheading Formatting only
Reviews, Spacer Not supported

Which variables a field can use depends on the block. For example, Line item text doesn’t know the cart total, and blocks placed outside the line item slot don’t know about a single line. The variables page lists where each one is available.

The thank you and order status pages support a smaller set of formatting and variables. See on the thank you page.

A few habits prevent most problems:

  • Copy variable names exactly. They’re case-sensitive: orderTotal, not ordertotal.
  • Guard metafields that might be missing, and write the full path once. Checkout Buddy only loads a metafield when it finds the plain path, such as variant.metafields.custom.material, in the expression: {{ line?.variant?.metafields?.custom?.material ? line.variant.metafields.custom.material : '' }}. See metafields.
  • Always pass the currency to toMoney: toMoney(amount, currencyCode). Without it, amounts are formatted as US dollars.
  • Values that don’t exist show as nothing. undefined, null, true and false all print as blank. 0 prints as 0.