To automatically add 1 unit of Product A to the cart when a user buys 10 units of Product B, the requirement can befulfilled 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 References: B2B Commerce and D2C Commerce Developer Guide, API Classes, cc_api_CartExtension Class
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit