Enterprise Wholesale DistributionB2B / Wholesale7 min read

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.

An ERP sending a pricing_group metafield rule that lights up matching products in a campaignThe ERP decides, the campaign executesERPVariant syncpricing_group = dealerDealer campaignMatched: 12,480Dealer pricing: no collections, tags or manual lists.

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.

InputValue (illustrative)
CatalogTens of thousands of products, most with several variants
Source of truthERP, synced to Shopify nightly
Pricing groupsdealer, industrial, government, contract, clearance, standard
Typical dealer itemList $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

ApproachSource of truthAutomationSide effectsWhen it is enough
Manually curated collectionsShopifyNoneCollections made only for pricing clutter merchandisingSmall, stable eligibility lists
Shopify automated collectionsShopify conditions (tags, type, vendor, and for supported types, metafields)Automatic when products changeSame collection clutterRules Shopify's collection conditions can express; check Shopify's help for supported metafield types
Tags written by the ERPERP, flattened to labelsAutomatic if the integration adds and removes tagsTag sprawl; stale tags; tags can appear in storefront filters if your theme uses themFew states, disciplined integration
Variant metafield rule in Discount PrimeERP field, read directlyRe-evaluated by a background job when auto-update is onNone on the storefrontMany 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

BehaviorDetail
What it readsVariant metafields only
Operatorsequals, not equals, greater than (or equal), less than (or equal), contains
NumbersCompared as numbers when both values parse as numbers
Missing metafieldMatches only a "not equals" condition
When matching happensIn the backend; matching variants are written to the campaign. With auto-update on, a background job re-evaluates roughly every few minutes
Campaign typesTiered Quantity Discount, Product Spend Discount, Tiered Unit Pricing, Wholesale / B2B Pricing, Dropshipping Pricing
PlanThe 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_groupCampaignNotes
dealerWholesale / B2B Pricing, rule pricing_group equals dealer, eligibility: a dealer customer segmentTiered dealer pricing; customers must be logged in
industrialWholesale / B2B Pricing, rule equals industrial, its own eligibilitySeparate tiers
governmentNo promotional campaignContract prices maintained in the ERP or in Shopify B2B catalogs
contractNo campaignExcluded by not being targeted
clearanceBulk Price Update on a tag or collection the ERP maintainsBulk Price Update does not offer the metafield rule; it changes the real Shopify price
standardNoneRetail 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 margin21.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

  1. The ERP reclassifies a product from standard to dealer.
  2. The nightly sync writes the new variant metafield value to Shopify.
  3. 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.
  4. 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 inputExpected result
Variant with pricing_group = dealer, dealer customer logged in, 25 unitsDealer tier price
Cart with only this item, 24 unitsNo dealer tier (tiers count the combined quantity of the campaign's items)
Same variant, guest checkoutNo dealer price
Variant with no pricing_groupNot in the dealer campaign
Value written on the product, not the variantNot matched (fix the integration mapping)
Change a test variant's value, wait for the auto-update runVariant enters or leaves the campaign
Variant with no Shopify unit cost, profit protection onBehaves 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.

More case studies