Subject: Metafield and Functions payload size limits prevent wholesale pricing for large product catalogs — requesting guidance on recommended architecture
Hi Shopify Support,
We are building a wholesale pricing app for B2B merchants. We are hitting size limits in two places and would like guidance on the recommended architecture for large stores.
Problem 1: Shop metafield size limit — storefront price display
We store wholesale plan configuration as a json type shop metafield (namespace: easywholesale, key: discount_cache, storefront access: PUBLIC_READ). Our Theme App Extension JavaScript reads this metafield and displays wholesale prices to eligible logged-in customers.
For each plan we store the list of product handles covered by the plan so the storefront JS can do instant price lookups without per-product API calls. A store with 15 collections can easily have 10,000+ product handles. Once the metafield JSON exceeds ~220KB, Shopify returns userErrors and the write fails — wholesale prices stop displaying on the storefront entirely.
Problem 2: Checkout discount function — plan data size limit
We use a Shopify Function (discount extension) to apply wholesale discounts at checkout. The function reads plan configuration from metafields on the global discount node to determine which customers and products are eligible. For large stores with many products across multiple plans, the combined plan data that the function needs to read also approaches size limits, causing the function to receive incomplete eligibility data and not apply the correct discount.
Our specific questions:
-
What is the recommended way to make large product datasets (10,000+ handles) available to storefront JavaScript without per-product API calls at page load? Is there a storage option larger than the
jsonmetafield limit (e.g. Files API with public access)? -
For Shopify Functions, what is the input payload size limit and can it be increased for Partner apps? What is the recommended approach for functions that need to evaluate eligibility against a large product catalog?
-
Is there an official pattern for wholesale/B2B pricing apps serving large catalogs on the storefront and at checkout? Other apps appear to handle this — are they using a different API or storage mechanism?
-
Would product-level metafields (one metafield per variant storing its plan eligibility) be the recommended approach to avoid these combined-size problems? What are the rate limits for writing metafields across 50,000+ products when a plan changes?
App details:
- App type: Public app (Shopify App Store)
- Extensions: Theme App Extension + Shopify Function (discount type)
- Storefront access:
PUBLIC_READshop metafield