Cart & discount application
This is the detail most worth getting right. Kitenzo doesn’t discount at request time — the Shopify cart transform applies the bundle discount at checkout. Your job is to give the cart the data the transform needs.
How discounting works by bundle type
Section titled “How discounting works by bundle type”| Bundle type | Where the discount lives | What you must do |
|---|---|---|
single-product | In the variant price | Add the configured variant. Nothing extra. |
multiple-products | In the variant price | Add the configured variant. Nothing extra. |
native | Applied at checkout by the cart transform | Add one line per variant with _bundle_data, and write the cart-level _bundles attribute. |
The two cart keys (native bundles)
Section titled “The two cart keys (native bundles)”_bundle_data— a per-line attribute that ties each cart line to its configured bundle. The SDK’sbuildCartLinesadds it automatically. If you reconstruct lines by hand (e.g. restoring a saved cart), every native-bundle line must carry it._bundles— a cart-level attribute (JSON) mappingconfiguredBundleId→ bundle content. The cart transform reads it to apply the discount. Set it viabuildCartPayload/addBundleToCart, or write it yourself from the embed’sbundleContent.
The reliable path (SDK)
Section titled “The reliable path (SDK)”const result = await client.submitBundle(bundle, selections); // or useBundleCart()await addBundleToCart(result, { addLines: (lines) => cart.linesAdd(lines), getAttributes: () => cart.attributes ?? [], setAttributes: (attrs) => cart.cartAttributesUpdate(attrs),});addBundleToCart (and buildCartPayload) inspect the bundle type and only write _bundles when needed — so the same code is correct for all three types.
The reliable path (Embed)
Section titled “The reliable path (Embed)”The embed gives you everything in the onAddToCart payload — add lines, and if bundleContent is present (native), write it into _bundles. See Cart integration.
Verifying it worked
Section titled “Verifying it worked”- Inspect the cart’s attributes: a native bundle should have a
_bundlesentry keyed by the configured bundle ID. - Each native-bundle line should carry a
_bundle_dataattribute. - The discount itself appears at checkout (the transform runs on Shopify’s servers), not necessarily in an intermediate cart subtotal.