Skip to main content
All CollectionsDeveloper resources
MBC Bundle global object
MBC Bundle global object
N
Written by Narmina Balabayli
Updated over a week ago

A global object is an object that is available in the global scope, meaning it can be accessed from anywhere in the JavaScript environment (e.g., browser window).

Here, MAKEBECOOL_BUNDLES is a global object provided by the MBC Bundle script, which allows store owners to interact with its bundling functionality.

This global object is used for managing and extending bundle functionality in a Shopify store.

Here you can check a brief description of the MBC Bundle global methods, fields and events that can be used for custom functionality extension by the store owner:

Methods

// Widget loading
MAKEBECOOL_BUNDLES.loadWidgetScript()

// Widget initialization on the product page
MAKEBECOOL_BUNDLES.initWidget()

// Widget initialization on the collection page
MAKEBECOOL_BUNDLES.initWidgetOnCollectionPage()

// Change language
MAKEBECOOL_BUNDLES.changeLanguage(code)

// Show MBC Bundles discount on cart page
MAKEBECOOL_BUNDLES.updateCart()

// Apply discounted MBC Bundles to ajax cart
MAKEBECOOL_BUNDLES.cartDataFix(cart)
// ex.
async function buildCart (cartData) {
cartData = await MAKEBECOOL_BUNDLES.cartDataFix(cartData)
}

Properties

// Collected combinations in the basket
MAKEBECOOL_BUNDLES.applicableCombos

// Bundles for the current product (only on the product page)
MAKEBECOOL_BUNDLES.bundlesForCurrentProduct

Events

// Items have been added to cart
MAKEBECOOL_BUNDLES.updateCart

// The discount on the cart page has been calculated and displayed
MAKEBECOOL_BUNDLES.pricingCalculated

// ex.
document.addEventListener('MAKEBECOOL_BUNDLES.updateCart' callback)

Did this answer your question?