Metafields Setup
Metafields store MUP configuration and product alcohol unit data. This guide explains how to set them up.
Automatic Setup
The easiest way to set up metafields is using the app:
- Go to MUP Settings in the app
- Click "Setup Metafields" in the secondary actions
- Wait for confirmation
This creates all required metafield definitions in your Shopify store.
What Gets Created
Shop-Level Metafields
These store your MUP configuration:
custom.mup_levy_product- Type: Single line text
- Stores: Levy product variant ID
-
Used by: Cart transform to add levy charges
-
custom.minimum_unit_price - Type: Number (decimal)
- Stores: Minimum price per alcohol unit (default: 0.65)
-
Used by: Cart transform and validation
-
custom.mup_enforcement_enabled - Type: Boolean
- Stores: Whether MUP enforcement is active
- Used by: All MUP functions
Product Variant-Level Metafields
These store alcohol unit data for each product:
custom.total_units- Type: Number (decimal)
- Stores: Total alcohol units per item
- Required for: MUP calculations
-
Example:
2.5for a 500ml can at 5% ABV -
custom.abv_percentage(Optional) - Type: Number (decimal)
- Stores: Alcohol by volume percentage
- Used for: Calculating units if
total_unitsis not set -
Example:
5.0for 5% ABV -
custom.volume_ml(Optional) - Type: Number (integer)
- Stores: Product volume in milliliters
- Used for: Calculating units if
total_unitsis not set - Example:
330for a 330ml can
Viewing Metafields
After setup, you can view metafield definitions in:
Shopify Admin → Settings → Custom data
Here you'll see: - All MUP metafield definitions - Their types and descriptions - Where they're used
Using Metafields
Shop Metafields
Shop metafields are automatically managed through the MUP Settings page. You don't need to edit them manually.
Product Metafields
Product metafields are added to individual products:
- Go to Products in Shopify Admin
- Select a product
- Scroll to the Metafields section
- Add the
custom.total_unitsmetafield - Enter the alcohol units value
- Save
See Adding Alcohol Units for detailed instructions.
Calculation Methods
You can provide alcohol unit data in two ways:
Method 1: Direct Units (Recommended)
Add custom.total_units directly:
- Most accurate
- No calculation needed
- Example: 2.5 units
Method 2: Calculate from ABV and Volume
If you provide both custom.abv_percentage and custom.volume_ml, the app can calculate units:
- Formula: (ABV% × Volume in ml) / 1000
- Example: (5.0 × 500) / 1000 = 2.5 units
Note: If total_units is provided, it takes precedence over calculated values.
Troubleshooting
Metafields not appearing? - Run "Setup Metafields" again (safe to run multiple times) - Check Shopify Admin → Settings → Custom data - Ensure you have admin permissions
Can't add metafields to products? - Verify metafield definitions exist - Check that you're editing a product variant - Ensure metafield type matches (number for units, etc.)
For more help, see Troubleshooting.