Metafields in FlexiFees
Last updated: September 23, 2026
FlexiFees reads Shopify product and variant metafields in three places: metafield conditions (which products a fee applies to), the Per unit of metafield and Percentage of metafield fee types (how much the fee is), and formulas (mf, pmf, sum_mf, sum_pmf). Wherever you enter a metafield, your store's own definitions are offered in a list.
Where metafields are used
| Where | What the metafield does | Value needed |
|---|---|---|
| Product metafield and Variant metafield conditions | Decide which products the fee applies to, for example custom.battery:true | Any value you can match as text |
| Per unit of metafield | Supplies the number the rate is multiplied by | A number |
| Percentage of metafield | Supplies the amount the percentage is taken of | A number or money amount |
| Formulas | mf and pmf read one product's value; sum_mf and sum_pmf sum them over the cart | A number |
Accepted value types for fee amounts
The metafield fee types and formulas need a numeric value: number (integer or decimal), money, or a unit type such as weight. Empty or text values count as 0, and a fee whose total is 0 is not added.
Unit values are not converted. For a unit type such as weight or volume, FlexiFees reads the number as it is stored: 0.75 liters reads as 0.75, the same volume stored as 750 milliliters reads as 750. Store all products in the same unit, or use a plain number metafield with the unit in its name, such as custom.volume_ml.
Set up a metafield for FlexiFees
- In your Shopify admin, go to Settings > Metafields and metaobjects and choose Products or Variants. You can also open a product and click Add definition in its Metafields section.
- Add a definition with a clear namespace and key, for example
custom.pouches_per_can, and a number or money type. - In the definition, select Storefronts (storefront access), so its value can be read in the cart.
- Fill in the value on each product or variant that should carry the fee.
Use a variant metafield when the value differs between variants (a 10-pack and a 20-pack), a product metafield when all variants share it.
The definition picker
- Wherever you enter a metafield (metafield conditions, the metafield fee types, formulas), FlexiFees offers your store's own product or variant metafield definitions in a list. Pick one and the namespace and key are filled in exactly.
- Typing stays possible. If a key matches no definition in your store, a quiet warning appears, and again after saving. It never blocks saving, because metafields created by other apps without a definition are allowed. Treat the warning as a spelling check: a typo means the fee never applies.
How to check a product's value
- Open the product in your Shopify admin and scroll to its metafields; variant metafields are on each variant's page.
- In a formula fee, Try it on a real product shows the value found for each
mf(...)orpmf(...)in the formula, so a missing value shows up as 0 before you publish.
Related
Questions
Can I use a metafield created by another app?
You can enter any namespace and key, even without a definition in your store; FlexiFees shows a warning but never blocks saving. The value must be numeric for fee amounts.
Why does my metafield fee show no line?
Usually the value is empty, not numeric, or the key is spelled differently. Products without a numeric value contribute 0, and a fee whose total is 0 is not added. Pick the key from the definition list to rule out typos.