Metafield-Based Product Targeting: Let Your ERP Drive Shopify Discounts
Designing wholesale pricing where an ERP-synced variant metafield rule replaces hand-built product lists, with its real limits on types, timing, and missing values.
A fictional distributor syncs an ERP pricing group to a Shopify variant metafield and targets Wholesale / B2B Pricing campaigns with rules such as pricing_group equals dealer. Matching runs in a background job minutes after each sync, not at checkout. A missing metafield matches only "not equals" rules, so positive rules protect unclassified products. The rule is not offered on Bulk Price Update.
At a glance
- Challenge
- A large distributor rebuilt ERP eligibility rules inside Shopify by hand, and the Shopify copy lagged for days whenever thousands of products changed pricing group.
- Approach
- Wholesale / B2B Pricing campaigns target an ERP-synced pricing_group variant metafield with positive rules; clearance uses Bulk Price Update on an ERP-maintained tag, and overlaps go through the conflict resolver.
- Discount Prime campaign types used
- Wholesale / B2B PricingMetafield TargetingBulk Price Update
Scenario-based case study: the merchant is fictional and modeled on patterns across Discount Prime stores. Prices, costs and outcome figures are illustrative assumptions for teaching, not measured results from a real store.
Short Answer
If your ERP already classifies which products may receive which pricing, sync that classification to a Shopify variant metafield (for example pricing_group) and point the campaign at a rule such as pricing_group equals dealer. You stop rebuilding product lists by hand. Three limits shape the design: Discount Prime's metafield rule reads variant metafields only (not product metafields); it is offered on Tiered Quantity Discount, Product Spend Discount, Tiered Unit Pricing, Wholesale / B2B Pricing, and Dropshipping Pricing; and matching is computed by a background job, not live at checkout, so changes take effect minutes after a sync, not instantly.
Merchant Scenario
Atlas Industrial Group is a fictional wholesale distributor of industrial equipment on Shopify Plus. Its catalog and every commercial classification come from the ERP: names, inventory, cost, supplier, and a pricing group that decides how each product may be sold.
| Input | Value (illustrative) |
|---|---|
| Catalog | Tens of thousands of products, most with several variants |
| Source of truth | ERP, synced to Shopify nightly |
| Pricing groups | dealer, industrial, government, contract, clearance, standard |
| Typical dealer item | List $148.00, Shopify unit cost $96.20 |
The marketing team mirrored ERP eligibility inside Shopify by hand: collections rebuilt, tags added, campaigns edited. When thousands of products changed pricing group in one ERP update, the Shopify side lagged for days. The pricing was not the problem; keeping two copies of the same rule in sync was.
Fits and Does Not Fit
Metafield targeting fits when:
- a reliable upstream system (ERP or PIM) already holds the classification;
- eligibility changes often or affects many products at once;
- the campaign type you need offers the metafield rule (see below).
It does not fit, or is unnecessary, when:
- eligibility is a short, stable product list (pick products or a collection);
- the classification lives only on products, not variants, and your integration cannot write variant metafields;
- you need it on a campaign type that does not offer the rule, such as Bulk Price Update or Flat Product Discount.
Alternatives Compared
| Approach | Source of truth | Automation | Side effects | When it is enough |
|---|---|---|---|---|
| Manually curated collections | Shopify | None | Collections made only for pricing clutter merchandising | Small, stable eligibility lists |
| Shopify automated collections | Shopify conditions (tags, type, vendor, and for supported types, metafields) | Automatic when products change | Same collection clutter | Rules Shopify's collection conditions can express; check Shopify's help for supported metafield types |
| Tags written by the ERP | ERP, flattened to labels | Automatic if the integration adds and removes tags | Tag sprawl; stale tags; tags can appear in storefront filters if your theme uses them | Few states, disciplined integration |
| Variant metafield rule in Discount Prime | ERP field, read directly | Re-evaluated by a background job when auto-update is on | None on the storefront | Many products, frequent ERP changes, supported campaign types |
Is native Shopify enough?
On Shopify Plus, Shopify B2B (companies, company locations, and catalogs with price lists) can give each company its own prices natively. If your dealer and government pricing are per company and your ERP integration already writes B2B catalogs, that may be all you need. Discount Prime does not use Shopify B2B companies or catalogs: its "B2B" eligibility means customer segments, specific customers, or logged-in customers. Choose Discount Prime's Wholesale / B2B Pricing when you want tiered quantity or spend pricing, margin floors, and storefront tier tables driven by a rule rather than per-company price lists.
How the Metafield Rule Works
| Behavior | Detail |
|---|---|
| What it reads | Variant metafields only |
| Operators | equals, not equals, greater than (or equal), less than (or equal), contains |
| Numbers | Compared as numbers when both values parse as numbers |
| Missing metafield | Matches only a "not equals" condition |
| When matching happens | In the backend; matching variants are written to the campaign. With auto-update on, a background job re-evaluates roughly every few minutes |
| Campaign types | Tiered Quantity Discount, Product Spend Discount, Tiered Unit Pricing, Wholesale / B2B Pricing, Dropshipping Pricing |
| Plan | The rule is plan-gated; check pricing |
The missing-metafield behavior matters. A rule like pricing_group not equals contract also includes every variant that has no pricing_group at all, including new products the ERP has not classified yet. Prefer positive rules (equals dealer) for anything you must never discount by accident.
The Architecture
| pricing_group | Campaign | Notes |
|---|---|---|
| dealer | Wholesale / B2B Pricing, rule pricing_group equals dealer, eligibility: a dealer customer segment | Tiered dealer pricing; customers must be logged in |
| industrial | Wholesale / B2B Pricing, rule equals industrial, its own eligibility | Separate tiers |
| government | No promotional campaign | Contract prices maintained in the ERP or in Shopify B2B catalogs |
| contract | No campaign | Excluded by not being targeted |
| clearance | Bulk Price Update on a tag or collection the ERP maintains | Bulk Price Update does not offer the metafield rule; it changes the real Shopify price |
| standard | None | Retail price |
Overlaps. If two price-changing campaigns target the same variant, Discount Prime keeps the variant with the campaign that already holds it, and a conflict resolver lets you keep it there or move it. There is no priority setting. Review conflicts when a reclassification moves products between groups, because the first campaign keeps them until you move them.
Customers. Dealer eligibility comes from a customer segment, specific customers, or logged-in customers. Segments are synced to a customer metafield by a frequent background job and are capped at 50,000 members per segment. A restricted campaign requires the customer to be logged in at checkout.
Plan limits. A large catalog can mean many live variants. Each plan has a live-variant limit; a campaign that exceeds it is held with a "need upgrade" status. Check the current limits on the pricing page before sizing campaigns for a whole catalog.
Dealer Pricing Example
Illustrative assumptions: Wholesale / B2B Pricing with price-based tiers; the 25+ unit tier gives 17% off the selling price; profit protection off; cost comes from Shopify's unit cost.
| Line (40 units of one item) | Amount |
|---|---|
| List price | $148.00 × 40 = $5,920.00 |
| Dealer price | $148.00 × 0.83 = $122.84 per unit, $4,913.60 total |
| Discount given | $1,006.40 |
| Product cost | $96.20 × 40 = $3,848.00 |
| Gross profit (price minus product cost only) | $1,065.60 |
| Gross margin | 21.7% of the dealer price |
This gross profit excludes payment fees, freight, fulfillment, and returns. Per unit, the dealer tier gives up $25.16 of the $51.80 list-price gross profit. To adapt: replace list price, cost, and tier percentage with your own, and if your agreements require a minimum profit, turn on Wholesale profit protection, which sets a floor of cost plus a minimum markup (fixed or percentage of cost) and caps the discount at that floor.
Profit protection depends on cost data. If a variant has no Shopify unit cost, the missing-cost setting decides whether it is skipped or discounted without a floor; check that setting explicitly, because the defaults are not consistent between screens.
What Happens When the ERP Changes
- The ERP reclassifies a product from
standardtodealer. - The nightly sync writes the new variant metafield value to Shopify.
- With auto-update on, the next background run adds the variant to the dealer campaign and writes its dealer price. Expect a delay of minutes after the sync, plus queue time on large updates.
- A logged-in dealer sees the dealer price on the next cart change.
If the sync fails or writes the value to the product instead of the variant, nothing errors; the product simply does not match. That is why the monitoring below checks counts, not only prices.
Pre-Launch Tests
| Test input | Expected result |
|---|---|
Variant with pricing_group = dealer, dealer customer logged in, 25 units | Dealer tier price |
| Cart with only this item, 24 units | No dealer tier (tiers count the combined quantity of the campaign's items) |
| Same variant, guest checkout | No dealer price |
Variant with no pricing_group | Not in the dealer campaign |
| Value written on the product, not the variant | Not matched (fix the integration mapping) |
| Change a test variant's value, wait for the auto-update run | Variant enters or leaves the campaign |
| Variant with no Shopify unit cost, profit protection on | Behaves as your missing-cost setting says |
Measurement
- Operational: variants matched per campaign after each sync, compared with the ERP's count for that pricing group (a gap signals a mapping problem); time from ERP change to price change; conflicts raised per month.
- Financial: gross profit and gross margin per campaign in Discount Prime's profit analytics (lines without cost are left out of both revenue and cost there), next to dealer revenue.
- Next decision: if matched counts drift from the ERP, fix the integration before touching the campaign; if dealer margin falls toward your floor, revisit tiers or turn on profit protection.
Common Mistakes
- Writing the classification to product metafields when the rule reads variant metafields.
- Using "not equals" rules that silently include unclassified variants.
- Expecting changes to apply the instant the ERP updates; matching runs in the background.
- Assuming a later campaign overrides an earlier one on the same variant; the first holder keeps it until you move it.
- Planning metafield targeting on Bulk Price Update or other types that do not offer the rule.
- Treating Discount Prime "B2B" as Shopify B2B companies; it uses segments, specific customers, or logged-in customers.
Frequently asked questions
How do I target Shopify discounts by metafield instead of collections?
Sync a field such as pricing_group from your ERP or PIM to each variant, then add a variant metafield rule to the campaign, for example pricing_group equals dealer. In Discount Prime the rule reads variant metafields only (not product metafields) and is offered on Tiered Quantity Discount, Product Spend Discount, Tiered Unit Pricing, Wholesale / B2B Pricing, and Dropshipping Pricing. Shopify automated collections can also use metafield conditions for supported types.
How quickly does a metafield change update the discount?
Not instantly. Matching is computed in the backend, not at checkout. With auto-update on, a background job re-evaluates matching every few minutes and writes the new prices, so expect a delay of minutes after your sync, longer for very large updates. If the ERP writes the value to the product instead of the variant, the variant simply does not match and no error appears.
What happens to products that have no metafield value?
A variant with no value matches only a "not equals" condition. A rule like pricing_group not equals contract therefore includes every unclassified variant, including new products the ERP has not classified yet. Use positive rules (equals dealer) for anything you must not discount by accident.
Does Discount Prime use Shopify B2B companies and catalogs?
No. In Discount Prime, B2B eligibility means customer segments, specific customers, or logged-in customers; it does not read Shopify B2B companies or company locations. On Shopify Plus, native B2B catalogs with price lists may already cover per-company contract pricing. Use Wholesale / B2B Pricing when you want tiered quantity or spend pricing with optional margin floors driven by a rule.
What if two campaigns target the same product after a reclassification?
For price-changing campaigns, the campaign that already holds the variant keeps it, and the conflict resolver lets you keep it or move it to the new campaign. There is no priority setting, and the newer campaign does not win automatically, so review conflicts after large ERP reclassifications.
Go deeper
Run this architecture in your store
Every campaign type in this case study is included in Discount Prime, with profit analytics to verify the margin impact.