Tab Commerce

Use metafields as discount conditions

Drive checkout discounts from customer, product, and variant metafields written by loyalty, review, or segmentation tools.

Tab Promo’s External data runtime reads customer, product, and variant metafields as discount conditions. Any metafield a merchant already maintains — loyalty tier from a points app, review rating from a review app, RFM segment from a CRM, batch attributes written by an ERP — can drive a checkout discount without writing custom code or exporting customer lists.

External data campaigns can be configured and previewed on any plan. Publishing them requires Pro or Growth.

When to use the External data runtime

Use External data when at least one condition reads a metafield. Examples:

  • “Customers whose loyalty.tier is gold get 15% off the order”
  • “Carts containing a product whose reviews.rating is at least 4.7 get $10 off the order”
  • “Variants whose batch.season is winter get $5 off each unit”

A Product metafield or Variant metafield condition qualifies the whole cart when any cart line carries the value. It does not limit which items get the discount. To discount only the matching items, set the action’s Discount applies to to Selected items and select by Variants matching metafield. Only variant metafields can scope a discount this way.

Use Core segmentation when every condition can be expressed with native Shopify signals (customer tags, B2B status, country, currency, cart subtotal, collection membership, product set). Core segmentation has two customer-tag, two collection, and two product-set slots and no metafield slots. External data gives up the customer-tag and product-set slots and keeps one collection slot, in exchange for metafield slots inside the Shopify Function input budget.

Slot budget

The External data runtime reserves a small, fixed number of slots inside the Shopify Function input query. The current allocation is:

  • Customer metafield — 1 slot
  • Product metafield — 1 slot
  • Variant metafield — 1 slot
  • Collection — 1 slot

A rule using one customer metafield and one product metafield consumes one slot of each type. Rules that read the same metafield share its slot. A collection condition, for example a collection-scoped product discount alongside a metafield condition, uses the collection slot. The slot budget is shared across all rules in the campaign. If you need more metafields than fit, split the work into multiple campaigns.

Prepare the metafield in Shopify

Before authoring the rule, make sure the metafield exists on the resource you want to read.

  1. Open Settings → Custom data in Shopify admin
  2. Choose the resource (Customer, Product, or Variant)
  3. Define a metafield with a stable namespace and key, for example loyalty.tier
  4. Pick a scalar type — single line text, number, or boolean
  5. Confirm at least one record carries a value you can test against

Tab Promo compares metafield values with the operators ==, !=, >, >=, <, <=. Complex shapes such as JSON objects are not directly supported as runtime conditions.

Author the rule

When creating the campaign, set Runtime profile to External data. Then add a rule with one of these conditions:

  • Customer metafield, Product metafield, or Variant metafield — enter the Metafield as namespace.key exactly as defined in Shopify, choose a Comparator (==, !=, >, >=, <, <=), and enter the Expected value
  • Customer tier metafield — enter the Metafield and a list of Tier values; the condition matches when the customer’s value is one of them

You can combine metafield conditions with cart subtotal, cart total quantity, currency, country, logged-in customer, B2B company customer, order count, and customer spend. You can also use one collection, through Contains collection, a collection-based Scoped line total, or a collection-scoped action. Customer tag and contains product conditions are not available in this runtime, and the free shipping action cannot be published from it.

Validate before publishing

The order-based Preview flow supports External data campaigns. For the order you pick, it loads the customer, product, and variant metafield values the campaign’s rules reference, along with collection membership, and evaluates the compiled rules against them. Preview reads the values stored in Shopify when it runs, so update the test customer or products first if you need a specific value. Run it against an order placed by a customer who carries the value you want to match, and containing products or variants that carry theirs.

The Storefront sandbox does not load metafield values, so rules that read customer, product, or variant metafields will not match there. Use Preview for metafield rules. On the live storefront, Tab Promo reads product and variant metafields for cart lines, and customer metafields for logged-in shoppers. For a full end-to-end check, publish on a development store and walk through a real test checkout.

If the rule does not fire as expected, the most common causes are a wrong namespace.key, a value-type mismatch (string vs number), or no value set on the test record.

Operational notes

  • The runtime is fixed once the campaign has rules. If you later need native customer-tag or product-set slots, or more than one collection slot, create a new campaign on Core segmentation rather than switching runtimes.
  • A metafield value that does not exist on a record is missing, not zero or an empty string. At checkout a missing value never matches, even with !=. Preview can show a missing value as matching !=, so do not rely on != to catch records without a value.

What to avoid

  • Treating External data as “Core segmentation with extras” — it deliberately gives up native segment slots to make room for metafield slots
  • Expecting a product metafield condition to limit which items are discounted — use a variant metafield scope on the action
  • Storing complex JSON in the metafield and expecting Tab Promo to traverse it — keep metafields scalar for runtime use
  • Forgetting to seed test metafield values on a test customer before previewing