JavaScript code, variables, and custom text operators are available to most text-based blocks, allowing you to create more dynamic texts for certain blocks:

The key is to wrap any code/variables in double curly brackets, {{ <code goes here> }} , for example:

You are {{ 1500 - orderTotal }} away from free shipping!

Common variables

These variables are available to any text blocks that support dynamic text.

orderTotal
orderSubtotal
totalDiscountAmount
currencyCode
cartCompareAtPrice
checkoutNotes
selectedDeliveryOptionDescription
selectedDeliveryOptionLowerEstimate
selectedDeliveryOptionUpperEstimate
lines
customer

Line item variables

These variables are available only to line items, specifically when the app block is placed under the 1st slot of Items in cart in the checkout editor:

lineQuantity
lineTotalAmount
variantSku
compareAtPrice
price
line

Object variables

These variables have unique structures and are accessed as JS objects or arrays:

const line = {
  // attributes property available only with line item text block
  attributes: {
    key_one: 'value_1',
    key_two: 'value_2',
    ...
  },
  product: {
	  metafields: {
	    namespace_one: {
	      key_one: 'value_one'
	    },
	    ...
	  }
  },
  variant: {
    metafields: {
	    namespace_one: {
	      key_one: 'value_one'
	    },
	    ...
    }
  }
};

const lines = [
  {
    product: {
      metafields: {
        [<namespace>]: { <key>: <value>},
        ...
      }
    },
    variant: {
      metafields: {
        [<namespace>]: { <key>: <value>},
        ...
      }
    }
  }
];

const customer = {
	metafields: {
	  checkout_buddy: {
	    field: <value>
	  }
	}
}