Add the #DF24 Developer Keynote to your agenda. Join us in-person on 9/18 at 2:30 p.m. PT or on Salesforce+ at 5 p.m. PT for the must-see session built just for developers.

SDK Example: Add a Child Product to the Basket (Winter '20)

Use the example SDK code in this topic to add a child product to a basket.

Possible error conditions:

"AddToCartInput::getAPIPath() must have catalogCode."

"AddToCartInput::getAnonymousSiteRestUrl() must have catalogCode."

"AddToCartInput::getRequestPayload() must have basketAction."

"AddToCartInput::getRequestPayload() must have rootProductCode when basketAction is 'AddChildProduct'."

"AddToCartInput::getRequestPayload() must have parentLineKey when basketAction is 'AddChildProduct'."

"AddToCartInput::getRequestPayload() must have parentHierarchyPath when basketAction is 'AddChildProduct'."

"AddToCartInput::getRequestPayload() must have offer when basketAction is 'AddChildProduct'."

"AddToCartInput::getRequestPayload() must have cartContextkey when basketAction is 'AddChildProduct'."

"AddToCartInput::getRequestPayload() must have bundleContextKey when basketAction is 'AddChildProduct'."