Target by variant or 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.
Before you start
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.
Available conditions
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
Product variant targeting
Show badges based on variant-level data rather than product-level data — useful when only certain sizes, colors, or configurations should trigger the badge.
How to set up variant targeting
Metafield targeting
Metafield conditions target products based on custom data stored in Shopify metafields — any custom attribute you have defined for your products or variants.
Finding your metafield namespace and key
You need the metafield's reference before you can target it:
In Shopify admin, go to Settings → Custom data.
Select Products (or Variants for a variant metafield).
Open the metafield definition you want to use.
Copy its namespace and key — the app expects them together as
namespace.key, for examplecustom.material.

The app does not autocomplete metafield names. If the namespace, the key, or the value does not match exactly — including capitalization — the condition matches nothing and the badge simply will not appear.
How to set up metafield targeting
Enter the namespace and key
Type the metafield reference in the namespace.key format. For example:
custom.material— a custom material metafieldcustom.certification— a certification status metafielddescriptors.subtitle— a product subtitle metafield

Metafield targeting examples
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
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_featuredis equal totrueResult: a "Last Few Left" badge that appears only on featured products with fewer than 3 units left at the variant level.

If the badge does not appear after saving, check the metafield reference and value first, then confirm the products really match the rule. You can also click Discard next to Save to roll back to the last saved setup.
Next steps
Target by product attribute — Filter badges by product title, type, vendor, price, and more.
Target by country & language — Show badges to visitors in specific countries or languages.
Dynamic variables — Use live data like price, discount, and inventory count in your badge text.
Need support?
If you run into any difficulty while following these steps, contact us at support@samita.io.
Last updated
Was this helpful?



