A user wants to have a customized experience for adding items to the cart. The user
also wants the mini cart module to reflect changes to the state of the cart afterwords.
How should this requirement be fulfilled?
A . Leverage the Addto Cart Global API which add items to the cart and also refreshes the page with the new data.
B . Trigger the global „cartChange" event and then trigger „changeMiniCart" event after the Add to Cart Action on the custom button.
C . Write a custom Remote Action to refresh the Mini Cart and refresh the Cart Line item count on the Cart Link in the header.
D . Trigger the global „cartChange" event after the Add to Cart Action on the custom button.
Answer: D
Explanation:
To have a customized experience for adding items to the cart and also update the mini cart module, the requirement can be fulfilled by triggering the global “cartChange” event after the Add to Cart Action on the custom button. This event will notify all the components that are listening to it that the cart has changed and they should refresh their data accordingly. The mini cart module is one of these components, so it will update its state based on the new cart data.
Reference: B2B Commerce and D2C Commerce Developer Guide, Events
Latest B2B Commerce For Developers Dumps Valid Version with 139 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund