Where to store bundle discount for merge operations?

I’m trying the merge operations to group multiple components into a bundle. My use case is to select any N variants from a collection, e.g. customers select any 3 variants from a Tee collection, and get a discount

When I add the components to the cart, where should I store the discount for this specific bundle?

I think your doc is wrong for customized bundles. This part states that:

Discount calculated on the parent then allocated on the components.

When I add the components to the cart for a merge operation, the bundle parent is not available so as the discount. What is a good technical approach? I store all bundle discounts to a shop/app/cart transform metafield for query?

And the metafield has a size limitation of 10KB. A store with multiple bundles can easily reach this limit.

1 Like

Facing the same issue and looking for alternatives, as this not only increases data size but also impacts instruction count limits.

Our cart transformations are nearing the instruction count limit, mainly due to storing data in metafields and the computation required to parse them.

If you are trying to reduce the instruction count limit, using Rust should be a possible way though I don’t know it. I stick with js now.

My main concern is to store all bundle discounts into a single metafield. The size is limited but users keep creating new bundles.

Some developers try to pass discounts with line item properties, but again this can use up the instruction count limit easily.