JS Events
This document outlines the JavaScript events used in minicart.js and custom.js. These events help manage cart interactions, updates, and notifications within the shopping experience.
Events in minicart.js
carttotalitems
Description: This event is triggered to update the total number of items in the cart.
When: After retrieving the cart data in the getCart method.
Data: The number of items in the cart.
cartupdated
This event is triggered to indicate that the cart has been updated.
When: After successfully updating the item quantity in the cart in the updateCartItemQuantity method.
Data: No additional data.
showcartmessage
Description: This event is triggered to display a message in the cart.
When: After successfully or unsuccessfully updating the item quantity in the updateCartItemQuantity method.
Data: An object containing status, message, and description.
currentcartitems
Description: This event is triggered to transmit the current items in the cart.
When: After retrieving the cart data in the returnCartItems method.
Data: An array of the current cart items (this.cart.items).
Events in custom.js
cartupdated
Description: This event is triggered to indicate that the cart has been updated.
When: After adding products to the cart in the methods addToCartWithBundle, addToCart, and addGlobalBundleToCart.
Data: The current products in the cart (this.products).
toggleminicart
Description: This event is triggered to show or hide the mini cart.
When: After adding products to the cart in the methods addToCartWithBundle and addGlobalBundleToCart.
Data: No additional data.
showcartmessage
Description: This event is triggered to display a message in the cart.
When: After adding products to the cart in the methods addToCartWithBundle, addToCart, addGlobalBundleToCart, and in case of errors in these methods.
Data: An object containing status, message, and description.
Last updated
Was this helpful?