Hi guys.
I’m trying to retrieve the app configuration for the discount function via the discount metafield (using discountNode).
Unfortunately, I found out that in the metafield value returns null when it exceeds ~10k chars. The input size (for the function input) is not exceeded (using a maximum of 40 kB from a 128 kB limit). I have no idea why it returns null when the information is above ~10k chars. Because of that, we cannot store the information at all (because of that limit), even though we are using JSON…
PS: Cart attributes do not have that limit, but all information from the cart attribute is being displayed in the merchant orders (directly in Shopify Admin, when viewing any order), which is not ok…
Any ideas?
hi @niki151
Here’s a breakdown of what’s likely going on and a few possible workarounds:
Even though Shopify Functions support up to 128 KB total input, the metafield value size for discount nodes (and some other specific contexts) seems to truncate around ~10,000 characters — especially when stored as plain JSON. This behavior isn’t publicly documented in detail, but many devs have observed the same limitation.
So even though you’re well under the overall input budget, Shopify seems to cap the metafield.value field at around 10k chars for function input parsing.
Thank you for this information @Dotsquares
Is there some workaround for this? We tried to add multiple metafields, but they are still not enough because the query exceeds the max complexity of 30. I see the only possible solution to be the cart attributes, but they are visible in the Shopify Admin (when viewing the order), which adds a lot of unnecessary text (under Additional Information of the order).