Skip to content
Try free for 7 days
English
EnglishFrenchSoonItalianSoonJapaneseSoonSpanishSoonPortuguese (Portugal)SoonGermanSoonCzechSoonDanishSoonFinnishSoonKoreanSoonNorwegian (Bokmål)SoonDutchSoonPolishSoonPortuguese (Brazil)SoonTurkishSoonChinese (Simplified)SoonChinese (Traditional)Soon
Open in Claude Ask questions about this pageOpen in ChatGPT Ask questions about this page

Target by variant and metafield

Target badges by product variants, variant inventory, or the metafield values you have defined in Shopify.

Variant and metafield targeting gives you the most granular control over which products display your badge — target products by their variants and stock levels, or match them against custom metafield attributes you have defined in Shopify.

Both are condition types inside the Products tab of the badge editor, so the setup is the same as any other product condition — only the fields you fill in are different.

  • Open the badge you want to edit from Badges & Labels, or create a new one. See Target products if you are not sure how to open the editor.
  • For metafield targeting, the metafield must already exist in Shopify. Create it under Settings → Custom data first — see Finding your metafield namespace and key.
Condition What it targets Typical options
Select specific variants Individual variants you pick by hand search or browse · tick the variants that should show the badge
Product variants Whether a product has variants at all products with variants · product has no variants
Variant inventory Stock level of individual variants in stock · out of stock · stock availability greater than · stock availability less than
Product metafield A metafield defined on the product is equal to · is not equal to · contains · does not contain · is greater than · is less than
Variant metafield A metafield defined on the variant is equal to · is not equal to · contains · does not contain · is greater than · is less than

Show badges based on variant-level data rather than product-level data — useful when only certain sizes, colors, or configurations should trigger the badge.

  1. In the badge editor, click Products in the tab row at the top of the left panel (next to Design and Display).

    Products tab in the badge editor

    The badge editor tabs: Design, Products, and Display.

  2. Under Choose products to show this badge, select Products matching conditions. A Conditions card appears below.

    Products matching conditions selected, with the Conditions card below

    Choosing Products matching conditions reveals the Conditions card.

  3. Next to Products must match, pick all conditions (AND) or any condition (OR). Leave it on all conditions if you are adding a single rule.

  4. Click + Add conditions, then choose Product variants or Variant inventory from the condition dropdown.

  5. For Product variants, choose products with variants or product has no variants.

    For Variant inventory, choose the stock operator and — for the “greater than” and “less than” operators — enter the stock threshold.

    Variant inventory condition set to stock availability less than 3

    Example: target variants with fewer than 3 units left in stock.

  6. Click Save in the top-right corner. A Badge/Label updated confirmation appears and the rule takes effect on your storefront.

Metafield conditions target products based on custom data stored in Shopify metafields — any custom attribute you have defined for your products or variants.

You need the metafield’s reference before you can target it:

  1. In Shopify admin, go to Settings → Custom data.
  2. Select Products (or Variants for a variant metafield).
  3. Open the metafield definition you want to use.
  4. Copy its namespace and key — the app expects them together as namespace.key, for example custom.material.

Shopify Settings, Custom data, product metafield definition showing its namespace and key

The namespace and key are shown on the metafield definition page in Shopify admin.

  1. Open the Products tab and select “Products matching conditions”

    Section titled “Open the Products tab and select “Products matching conditions””

    Same as for variant targeting: Products tab → Products matching conditions → choose all conditions or any condition.

  2. Click + Add conditions, then choose Product metafield or Variant metafield.

  3. Type the metafield reference in the namespace.key format. For example:

    • custom.material — a custom material metafield
    • custom.certification — a certification status metafield
    • descriptors.subtitle — a product subtitle metafield

    Product metafield condition with the namespace key field filled in

    Enter the metafield reference using the namespace.key format.

  4. Choose the operator (is equal to, contains, is greater than, and so on) and type the value to match against. Use the number operators only for metafields that store numbers.

    Metafield condition with operator and value set

    A finished metafield rule: custom.material is equal to Organic.

  5. Click Save in the top-right corner. A Badge/Label updated confirmation appears.

Metafield (namespace.key) Operator Value Use case
custom.material is equal to Organic Show an “Organic” badge on organic products
custom.certification contains ISO Badge all ISO-certified products
custom.country_of_origin is equal to Italy Show a “Made in Italy” badge
custom.is_bestseller is equal to true Display a “Bestseller” badge
custom.rating is greater than 4 Show a “Top Rated” badge on highly rated items

Combining variant and metafield conditions

Section titled “Combining variant and metafield conditions”

Variant and metafield conditions can be combined with each other and with any other product condition. Add each rule with + Add conditions, then set Products must match to all conditions so every rule has to be true.

  • Variant inventory stock availability less than 3 AND Product metafield custom.is_featured is equal to true
  • Result: a “Last Few Left” badge that appears only on featured products with fewer than 3 units left at the variant level.

Two conditions combined with all conditions selected

Two rules combined with all conditions (AND) logic.

Was this helpful?