How can this requirement be fulfilled?

When a user buys 10 units of product B, the user wants 1 unit of Product A to be automatically added to the cart.

How can this requirement be fulfilled?
A . Override the AllowCheckout method in ccrz.cc_api_CartExtension
B . Override the prepareForSave method in ccrz.cc_api_CartExtension
C . Override the preprocess method in ccrz.cc_api_CartExtension
D . Override the prepareToAdd method in ccrz.cc_api_CartExtension

Answer: D

Explanation:

To automatically add 1 unit of Product A to the cart when a user buys 10 units of Product B, the requirement can be fulfilled by overriding the prepareToAdd method in ccrz.cc_api_CartExtension. This method is responsible for preparing the cart line items before they are added to the cart. By overriding this method, the user can check the quantity and product ID of the cart line items and add an additional cart line item for Product A if the condition is met.

Salesforce Reference: B2B Commerce and D2C Commerce Developer Guide, API Classes, cc_api_CartExtension Class

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments