Is there a limit to the length of the metafield in shopify function Input (STDIN)?

Topic summary

Core Issue:
Shopify Functions have a 10,000-byte limit for metafield values in input queries, causing metafields to return null when exceeding this threshold. This differs from online stores, where the same metafields display correctly and support up to 2 million characters for JSON types.

Key Findings:

  • The limitation is documented in Shopify Functions input-output specifications
  • One user cannot reproduce the issue on development stores, where large metafield values work fine
  • Functions handle metafields differently than the online store frontend

Proposed Workaround:

  • Split large JSON data across multiple metafields to stay under the 10KB limit per field
  • Caution: Each metafield read consumes 3 points toward the input query complexity limit of 30

Open Question:
How certain apps manage different inputs across multiple functions for various merchants, given these constraints.

Summarized with AI on October 25. AI used: claude-sonnet-4-5-20250929.

We are using shopify product discount function.

We store some configuration data in metafields.

When the metafield length reaches 10,000 characters, the metafield will not output any information (null will be displayed) as shown in the figure below.

But as far as I know, the json type metafield is limited to two million characters.

We edited the theme and used the same metafield in the online store and found that it can be displayed correctly.

We checked the documentation and did not find that the shopify function has any restrictions on metafields.

1 Like

Currently having this same exact issue. I am not able to reproduce the same behaviour on a development store, where everything seems to work fine with large metafield values.

It’s mentioned in the Shopify Functions docs:

https://shopify.dev/docs/apps/build/functions/input-output#limitations

Metafields with values exceeding 10,000 bytes in size will not be returned.

The online store simply handles metafields differently from how Functions does.

1 Like

If you’re pulling in a big json blob from an external api into a metafield in order to do discounts based on that, and if the blob is bigger than 10k, can you just split it into multiple metafields to get around that?

1 Like

You probably can. At that point, you’ll just have to be careful to not hit the input query complexity limit of 30.

Reading a metafield value consumes three points towards that limit.

1 Like

@tobebuilds @Kalen_Jordan @Zakaria_1 Do you know how this app SupaEasy: AI Functions creator - SupaEasy: migrate scripts and generate Functions with AI | Shopify App Store is able to manage different inputs for different functions… because I am able to use only same input QL for multiple merchants