Skip to content

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:

  1. Go to MUP Settings in the app
  2. Click "Setup Metafields" in the secondary actions
  3. 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.5 for a 500ml can at 5% ABV

  • custom.abv_percentage (Optional)

  • Type: Number (decimal)
  • Stores: Alcohol by volume percentage
  • Used for: Calculating units if total_units is not set
  • Example: 5.0 for 5% ABV

  • custom.volume_ml (Optional)

  • Type: Number (integer)
  • Stores: Product volume in milliliters
  • Used for: Calculating units if total_units is not set
  • Example: 330 for 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:

  1. Go to Products in Shopify Admin
  2. Select a product
  3. Scroll to the Metafields section
  4. Add the custom.total_units metafield
  5. Enter the alcohol units value
  6. Save

See Adding Alcohol Units for detailed instructions.

Calculation Methods

You can provide alcohol unit data in two ways:

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.