Default Bundle JavaScript
The JavaScript template contains the lifecycle hooks that power bundle interactivity. Each hook is called at a specific point in the bundle’s lifecycle and receives the bundle data along with utility functions.Hook Functions
OnBundleRender
The primary rendering hook. Transforms raw bundle data into the format consumed by the Liquid template. Calculates total price, resolves translations, and maps products with their options and variants.OnConfigLoad
Called when bundle configuration is first loaded. Use this to modify or enrich the bundle data before any rendering occurs. By default, returns the bundle unchanged.OnVariantChange
Fired when a customer selects a different variant. By default, updates the URL query parameter to reflect the selected variant ID.OnAddToCart
Called immediately when the add-to-cart action is triggered, before the cart API request. Use this for pre-cart validation or UI updates.OnAddedToCart
Called after a successful add-to-cart API response. Use this for post-cart actions like showing confirmation messages or triggering analytics.See the Hooks page for detailed parameter documentation and use cases for each hook.