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.
Before you start
Section titled “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
Section titled “Available conditions”| 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 |
Product variant targeting
Section titled “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
Section titled “How to set up variant targeting”-
Open the Products tab
Section titled “Open the Products tab”In the badge editor, click Products in the tab row at the top of the left panel (next to Design and Display).

The badge editor tabs: Design, Products, and Display.
-
Select “Products matching conditions”
Section titled “Select “Products matching conditions””Under Choose products to show this badge, select Products matching conditions. A Conditions card appears below.

Choosing Products matching conditions reveals the Conditions card.
-
Choose how the rules combine
Section titled “Choose how the rules combine”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.
-
Add the condition
Section titled “Add the condition”Click + Add conditions, then choose Product variants or Variant inventory from the condition dropdown.
-
Configure the condition
Section titled “Configure the condition”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.

Example: target variants with fewer than 3 units left in stock.
-
Click Save in the top-right corner. A Badge/Label updated confirmation appears and the rule takes effect on your storefront.
Metafield targeting
Section titled “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
Section titled “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 namespace and key are shown on the metafield definition page in Shopify admin.
How to set up metafield targeting
Section titled “How to set up metafield targeting”-
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.
-
Add the condition
Section titled “Add the condition”Click + Add conditions, then choose Product metafield or Variant metafield.
-
Enter the namespace and key
Section titled “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

Enter the metafield reference using the namespace.key format.
-
Select the operator and value
Section titled “Select the operator and value”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.

A finished metafield rule: custom.material is equal to Organic.
-
Click Save in the top-right corner. A Badge/Label updated confirmation appears.
Metafield targeting examples
Section titled “Metafield targeting examples”| 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_featuredis equal totrue - Result: a “Last Few Left” badge that appears only on featured products with fewer than 3 units left at the variant level.

Two rules combined with all conditions (AND) logic.
Next steps
Section titled “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.