This article explains how Swap supports Shopify metafields in two areas: as variant options in the returns portal, and as conditions in Advanced Rules.
Metafields as Variant Options in the Portal
If you store product relationships in Shopify metafields rather than as native Shopify variants, Swap reads these metafield-linked products and presents them as selectable variants during the exchange flow in the returns portal. These exchanges will be treated as Equal Exchanges.
How It Works
You configure a metafield mapping in the Swap dashboard. The returns portal then reads the linked products from that metafield and presents them alongside the standard variant options. Each linked product is displayed as a swatch using its first product image.
When a customer clicks on a swatch, the portal switches to show that product's variants and details — the same way it handles any other variant selection.
Equal exchange logic applies normally to metafield-linked variants.
Setting It Up
Go to Settings → Exchanges → Exchange Variant Options via Metafields.
Add a new entry with the Namespace and Key of the metafield you have configured in Shopify.
Save your settings.
Field | Example value |
Namespace |
|
Key |
|
The portal uses the first image of each linked product as its swatch image.
Note: Only product-level metafields are supported. If a metafield is missing or the configuration is invalid, the portal falls back to standard variant options and continues normally.
Metafields in Advanced Rules
Swap also supports Shopify metafields as conditions in Advanced Rules, allowing you to define return flows based on product or variant metafield values.
Available Conditions
Two new conditions are available in Advanced Rules:
Product metafield — matches against a product-level metafield value
Variant metafield — matches against a variant-level metafield value
Each condition is configured with:
Field | Description |
Namespace | The metafield namespace (e.g. |
Key | The metafield key (e.g. |
Operator | Is or Is not |
Value | The specific value to match against |
How to Use
Metafield conditions work with product-level actions in the Advanced Rules matrix. For example, you could route returns differently based on a product's material metafield, or apply a green return action to items with a specific tag stored as a metafield value.
Refer to the Advanced Rules article for a full list of available actions and the conditions matrix.
