Skip to content
Kitenzo Headless is currently invite-only. To enable it on your store, email support@kitenzo.com.

React — BundleEmbed

BundleEmbed is a thin React wrapper around createBundleEmbed. It loads the storefront script, fetches shop settings, mounts the <bundle-builder-bundle-v1> element and intercepts add-to-cart — all for you. It’s self-contained and does not require <KitenzoProvider>.

Terminal window
npm install @kitenzo/react

Peer dependencies: react >= 18, react-dom >= 18. Optional: @shopify/hydrogen-react >= 2024.0.0.

import { BundleEmbed } from '@kitenzo/react';
import { useCart } from '@shopify/hydrogen-react';
function BundlePage() {
const cart = useCart();
return (
<BundleEmbed
bundleId={42}
apiKey={import.meta.env.VITE_KITENZO_API_KEY}
shopDomain="your-store.myshopify.com"
onAddToCart={({ lines, bundleContent }) => {
cart.linesAdd(lines);
if (bundleContent) {
const existing = JSON.parse(
cart.attributes?.find((a) => a.key === '_bundles')?.value ?? '{}'
);
existing[bundleContent.configuredBundleId] = bundleContent;
cart.cartAttributesUpdate([
...(cart.attributes ?? []).filter((a) => a.key !== '_bundles'),
{ key: '_bundles', value: JSON.stringify(existing) },
]);
}
}}
/>
);
}
PropTypeRequiredDescription
bundleIdnumberYesBundle to display.
apiKeystringYesHeadless API key.
shopDomainstringYesYour myshopify.com domain.
onAddToCart(payload: EmbedCartPayload) => voidYesCalled with normalized cart lines (+ bundleContent for native bundles).
onError(error: Error) => voidNoCalled on script/settings load failure.
baseUrlstringNoOverride the API base URL (default https://live.bb.eight-cdn.com/api/headless/v1).
classNamestringNoCSS class for the container div.

EmbedCartPayload is { lines: CartLine[]; bundleContent?: BundleContentPayload }.

See Cart integration for the full onAddToCart payload and how to write the _bundles attribute.