Using the app global conversionBundlesBear window object you can invoke several methods and bind callbacks to help you tailor Bundle Bear to your store needs.
The JS SDK module will be available whenever the app is enabled from the app settings.
The following methods can be added to the app settings using the custom JS input box that is available in the app advanced tab.
updateSubtotal
conversionBundlesBear.updateSubtotal();
Use this method to trigger an update of the cart discounts element that is displayed in the storefront cart page. In case you would like to update an ajax cart discount element update pass in a boolean value of true e.g.
conversionBundlesBear.updateSubtotal(true);
goToCheckout
conversionBundlesBear.goToCheckout();
Use this method to redirect the customer to checkout with the relevant Bundle Bear discount if applicable.
setOnAcceptOffer
conversionBundlesBear.setOnAcceptOffer(callbackFunction);
Attach a callback function that will be triggered when a bundle offer is added to cart using the product widget.
For example:
conversionBundlesBear.setOnAcceptOffer((offerData)=>{console.log(offerData);});
setOnGoToCheckout
conversionBundlesBear.setOnGoToCheckout(callbackFunction);
Attach a callback function that will be triggered while the customer is navigating to checkout.
For example:
conversionBundlesBear.setOnGoToCheckout((discountData)=>{console.log(discountData);return true; // this will make Bundle Bear continue after this callback is executed});
Need anything custom for your use case? Let us know and we'll add it to our wishlist!