Available Variables

Built-in inputs for getting context on the user

Objects

customer

Customer variables represent a user's Shopify account information. These variables are refreshed when a customer signs in/out.

PropertyTypeExampleAvailability
customer.idString6669141901500When user is logged in
customer.firstNameStringJohnWhen user is logged in

cart

Cart variables allow you to access the contents of a customer's current cart. These variables are refreshed in real-time.

Standard Cart Contents

PropertyTypeExampleAvailability
cart.itemsArray<Items>[ { "quantity", "productId", "variantId", "sellingPlanId", "attributes"}]If items are in the cart
cart.subtotalFloat20.45 (Sum of cart items less any applied discounts)Always
cart.currencyStringUSDAlways

Cart Items

PropertyTypeExampleAvailability
cart.items.quantityInteger1If items are in the cart
cart.items.productIdString7629735690428If items are in the cart
cart.items.variantIdString43577520193749If items are in the cart
cart.items.sellingPlanIdString1039518903If selling plans are in cart
cart.items.atttributesArray[ { "key": "value" } ]If attributes are in the cart

device

Device variables are distinct to the user's device. If a user gets a new device, or deletes & reinstalls the app, they will receive a new device_id.

PropertyTypeExampleAvailability
device.idStringD40B48A7-0889-4E76-8946-5EA5EBDD29FFAlways
device.localeStringen_USAlways
device.windowHeightFloat600Always

product

Product variables are distinct to the product that's currently in view on the product detail page (PDP). These variables are refreshed when a user visits a new PDP.

Standard Product Properties

PropertyTypeExampleAvailability
product.idString7629735690428Always
product.availableForSaleBooleantrue | falseAlways
product.compareAtPriceFloat20.99If used
product.descriptionStringVintage cotton shirtIf used
product.handleStringvintage-shirtAlways
product.imagesArray[ "<https://example.com/image.jpg>" ]Always
product.optionsArray<ProductOption>[ { "name": "Color", "values": [ "Black", "Blue" ] } ]Always
product.priceFloat15.99Always
product.tagsArray["Vintage", "Cotton", "New"]If used
product.titleStringVintage TapcartAlways
product.urlString<https://www.tapcartcustomblocks.com/products/vintage-shirt>Always
product.vendorStringTapcartIf used
product.selectedVariantString6875079049404
product.variantsArray<ProductVariant>"variants": [ { "selectedOptions", "id", "price", "title", "isAvailable, "compareAtPrice", "image", "sku" } ]Always

Product Option Properties

PropertyTypeExampleAvailability
product.ProductOption.nameStringColorAlways
product.ProductOption.valuesArray['Black', 'Blue']Always

Product Variant Properties

PropertyTypeExampleAvailability
product.ProductVariant.idString43577520193749Always
product.ProductVariant.titleStringBlueAlways
product.ProductVariant.imageString<https://example.com/image.jpg>Always
product.ProductVariant.isAvailableBooleantrue | falseAlways
product.ProductVariant.priceFloat10.99Always
product.ProductVariant.compareAtPriceFloat20.99If used
product.ProductVariant.selectedOptionsArray<SelectedOption>[ { "name": "Color", "value": "Black" } ],Always
product.ProductVariant.skuString12938412Always

Product Variant Selected Options Properties

PropertyTypeExampleAvailability
product.SelectedOption.nameStringColorAlways
product.SelectedOption.valueStringBlackAlways

Metafields

Before using a product metafield variable your block, you'll first need to enable metafields for your Tapcart app, and include any specific metafields that your app should have access to.

When referencing a metafield variable in your block, make sure to specify the specific namespace & key you want to retrieve.

PropertyTypeExampleAvailability
product.metafields.namespace.keyObject{ "my-namespace": { "my-key": "my-value" } }Optional

Full Payload Example

{
  "customer": {
    "id": "779544431",
    "firstName": "John"
  },
  "device": {
    "id": "25679b7e-2348-44da-94ef-e218f6be4586",
    "locale": "en"
  },
  "cart": {
    "items": [
      {
        "quantity": 1,
        "productId": "7629735690428",
        "variantId": "43577520193749",
        "sellingPlanId": "1039518903",
        "attributes": [
          {
            "key": "value"
          }
        ]
      }
    ],
    "appliedDiscounts": ["TEST10"],
    "subtotal": 0,
    "currency": "USD"
  },
  "product": {
    "id": "6875079049404",
    "description": "<p>Vintage cotton Tapcart shirt</p>",
    "options": [
      {
        "name": "Color",
        "values": [
          "Black",
          "Blue"
        ]
      }
    ],
    "handle": "vintage-shirt",
    "tags": [
      "Vintage",
      "Cotton",
      "New"
    ],
    "availableForSale": true,
    "title": "Vintage Tapcart Shirt",
    "price": 55,
    "metafields": {
      "myNamespace1": {
        "myKey1": "myValue1"
      },
      "myNamespace2": {
        "myKey2": "myValue2"
      }
    },
    "compareAtPrice": 100,
    "vendor": "Tapcart",
    "images": [
      "https://assets-global.website-files.com/616f0a7a027baaf59a43390b/616f0a7a027baab7e743396e_full.svg"
    ],
    "selectedVariant": {
      "id": "6875079049404"
    },
    "variants": [
      {
        "selectedOptions": [
          {
            "name": "Color",
            "value": "Black"
          }
        ],
        "id": "40122114900156",
        "price": 55,
        "title": "Vintage Tapcart Shirt",
        "isAvailable": true,
        "compareAtPrice": 100,
        "image": "https://assets-global.website-files.com/616f0a7a027baaf59a43390b/616f0a7a027baab7e743396e_full.svg",
        "sku": "12938412"
      }
    ]
  }
}