Discussing Shopify Functions development, deployment, and usage in Shopify apps.
Facing an issue with product discounts using the 'discountAutomaticAppCreate' mutation. When dealing with a large volume of JSON data within metafields, the discounts don't seem to apply.
For example:
const discount = { functionId, combinesWith: form.combinesWith, startsAt: form.startDate, endsAt: form.endDate, metafields: [ { namespace: metafields.config.namespace, key: metafields.config.key, type: "json", value: JSON.stringify({ quantity: parseInt(form.config.quantity), percentage: parseFloat(form.config.percentage) }) } ] };
Suppose I have a large volume of data stored within a single metafield in that case the discount isn't applying. However, when I removed some data from the metafield, the discount applied perfectly. Has anyone else experienced a similar problem, or might there be something crucial that I might have overlooked in this context?
Any suggestions on how to resolve this, @Liam @Nick_Wesselman
I've reviewed the Shopify documentation, and it appears that there are limitations regarding Metafields values.
Here's the link for reference: https://shopify.dev/docs/apps/functions/input-output#limitations
Has anyone else encountered a similar issue? How have you tackled this kind of problem?
Hey @yedla_dinesh
Thanks for your patience.
You're spot on. Team said:
> They are likely hitting the 10KB metafield value limit, and their discount isn’t applying because the metafield value appears null
in that case.
Asking for workarounds and will report back.
Scott | Developer Advocate @ Shopify