Skip to main content
All CollectionsReference
Javascript helpers
Javascript helpers
Spencer Davies avatar
Written by Spencer Davies
Updated over 2 weeks ago

Note. Template Creator requires advanced knowledge of Liquid coding. If you're not confident with this template language, we'd recommend finding a Shopify Expert to work with. HeyCarson and StoreTasker are recommended partners of Kitenzo - both specializing in website development and offering free quotes for their services.

Using Javascript helpers with custom templates

Javascript helpers are globally-available functions to provide additional functionality to your custom templates.

window.BundleBuilder.canAddVariant(variantId, sectionIndex)

Returns true if a variant with given variantId from section (with index sectionIndex) can be added to the bundle, false otherwise. This depends on bundle limits and available variant quantity.

window.BundleBuilder.showMoreModal(variantId, sectionIndex, canSelectVariant, canAdd)

Includes a Read More modal dialog that shows all product images together with product description.

The variantId is an identifier of a variant that will be displayed. The sectionIndex is index of a section to which the variant belongs. canSelectVariant is optional and if set to false, it will hide variant selection dropdowns. canAdd is optional and if set to false, it will hide the button for adding variants to the bundle.


Add to Cart changes

Kitenzo by default will automatically redirect the customer to the Cart page once they are satisfied with the bundle.

This usually works via a button that by default is labeled Add bundle to cart.

It's possible to override this functionality, but it's not recommended to do so, as it might confuse the customer and affect their customer experience. Additionally, any further changes to the bundle won't be applied to the bundle already added to their cart.

We also suggest not reopening the cart drawer after closing it. The customer would still see the bundle, but changing it won't have any effect.

If you wish to override this feature despite the issues mentioned above, you can define a global Javascript function called bbAfterAddToCart - if defined it'll be called instead of redirecting to the cart page.

Example:

<script type="text/javascript"> window.bbAfterAddToCart = function () { // Do something instead of redirecting to cart } <script>
Did this answer your question?