ExamGecko
Question list
Search
Search

Question 48 - Certified B2B Commerce Developer discussion

Report
Export

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.
Answers
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.
Answers
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.
Answers
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.
Answers
D.
Trigger the global cartChange' event after the Add to Cart Action on the custom button.
Suggested 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. Salesforce

Reference:B2B Commerce and D2C Commerce Developer Guide,Events

asked 23/09/2024
Luis Hernaiz
40 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first