Unit price display (“Grundpreis” under German law) is a legal requirement for many Shopify merchants in Europe, especially in Germany and France. But Shopify still does NOT allow you to update these fields via the API, Matrixify, or any bulk editor. This article explains the problem—and gives you a full, practical workaround.

 

1. The Unit Price Problem in Shopify (2025)

If you sell regulated products in the EU—cosmetics, food, beverages, etc.—displaying a unit price (“€1.99/100ml”) is not optional. It’s the law.

But:

    • As of 2025, you cannot set or update the unit_price or unit_price_measurement fields (used for “Grundpreis” display) via Shopify’s API, GraphQL, Matrixify, or CSV bulk import/export.
    • You can only set them manually in Shopify Admin.

 

2. What Doesn’t Work: API, Matrixify & CSV

FeatureREST APIGraphQL APIMatrixifyCSV ImportShopify Admin
Read unit priceNoNoNoNoYes
Write unit priceNoNoNoNoYes
Read/write regular priceYesYesYesYesYes
    • Shopify and Matrixify support confirm: No app or API can bulk-edit unit price fields, because Shopify doesn’t allow it.
    • This is a huge pain for stores with many products.

 

3. Legal Background: Why Unit Price is Mandatory

EU law requires you to display unit price (“Grundpreis”) for many products. In Germany and France, non-compliance can mean legal penalties.

But Shopify only provides a manual solution, not a scalable one.


 

4. Our Solution: Custom Metafield & Liquid Snippet

How do we get around Shopify’s API limitation?

    • Volume Metafield: Save the product’s fill size (e.g., 50ml) in a custom metafield, e.g. custom.volume.
    • Custom Unit Price Calculation: Use Liquid code to calculate and display the price per 100ml (or other unit).
    • Display Logic: Show the calculated unit price on product pages, collection grids, and the cart—only if Shopify’s built-in unit price isn’t set.

 

5. Step-by-Step: How To Display Unit Price in Shopify

Step 1: Create Metafields for Volume and Unit Price

  1. In Shopify Admin, go to Settings > Custom data > Products.
  2. Click “Add definition”. Create a new metafield:
    • Name: Volume
    • Namespace and key: custom.volume
    • Type: Number (decimal) — e.g., “50” for 50ml.
    • Save.
  3. (Optional) Add another metafield for calculated unit price (if you want to store it):
    • Name: Unit Price
    • Namespace and key: custom.unit_price
    • Type: Single line text or decimal
    • Save.

Step 2: Bulk Update Metafields (Optional but recommended)

    • Use the Shopify Bulk Editor or Matrixify to set custom.volume for all products (e.g., extract from product titles like “50ml”, “200ml”).
    • If you use automation tools, you can update custom.volume metafields via API. You cannot update the official unit_price or unit_price_measurement fields.

Step 3: Edit Your Theme’s Liquid Files

Add this logic to show the calculated unit price everywhere your price is displayed.

A) Product Page

Find your product page template (commonly main-product.liquid or product-template.liquid).

Paste the following below the price:

{%- assign volume = product.metafields.custom.volume | default: 0.0 | plus: 0.0 -%}{%- assign price = current_variant.price | default: 0 -%}{%- if volume > 0 and (current_variant.unit_price_measurement == blank or current_variant.unit_price_measurement == nil) -%}  <div class="product__unit-price" style="color: #999; font-size: 1.1em; margin-top: .4em;">    {{ price | divided_by: volume | times: 100 | money }}/100 ml  </div>{%- endif -%}

B) Product Grid (Collections)

In your product grid snippet (like product-grid-item.liquid):

{%- assign product_variant = product.selected_or_first_available_variant -%}{%- assign volume = product.metafields.custom.volume | default: 0.0 | plus: 0.0 -%}{%- assign price = product_variant.price | default: 0 -%}{%- if volume > 0 and (product_variant.unit_price_measurement == blank or product_variant.unit_price_measurement == nil) -%}  <div class="product__unit-price" style="color: #999; font-size: 1.1em; margin-top: .4em;">    {{ price | divided_by: volume | times: 100 | money }}/100 ml  </div>{%- endif -%}

Add just below the price block in your grid template.


C) Cart Page

In your cart item snippet (e.g., cart-item.liquid):

{%- assign volume = product.product.metafields.custom.volume | default: 0.0 | plus: 0.0 -%}{%- assign price = product.final_price | default: 0 -%}{%- if volume > 0 and (product.unit_price_measurement == blank or product.unit_price_measurement == nil) -%}  <div class="product__unit-price" style="color: #999; font-size: 1em; margin-top: .3em;">    {{ price | divided_by: volume | times: 100 | money }}/100 ml  </div>{%- endif -%}

D) (Optional) Automation Tips

If prices change often, use external automation (n8n, Zapier, etc.) to update your custom.unit_price metafield whenever price or volume changes.


Step 4: Test Everything!

    • Check the display on product, collection, and cart pages.
    • Make sure the unit price shows only if the native Shopify field is not set.
    • Tip: Check your store for legal compliance—do not rely only on code!

 

6. FAQ & Troubleshooting

Is this legally sufficient?
Yes, if the unit price is shown clearly near the main price.

Can I show unit price at checkout?
Only possible if you are on Shopify Plus and can edit checkout.liquid. Otherwise, you cannot add extra info to checkout via Liquid or JavaScript.

Can I automate all of this?
You can automate filling the custom.volume metafield, but not the official unit price field. For real automation, monitor Shopify changelogs for future API updates.


 

7. Conclusion

Shopify’s lack of API support for unit price is a major pain for EU merchants in 2025. But with metafields, a little Liquid code, and this guide, you can stay compliant and transparent with your customers.

If you found this helpful, share it or link back! If you need a custom workflow for volume or unit price automation.


References


Copyright © 2025 Benitatech Not legal advice—always check your country’s compliance rules!