---
schema_version: "1"
id: d1798f67c4b58a294678d83ae7436fce015e4fd9266550822dd6aeac2fbb8058
title: "SDK Example: Delete a Child Product from the Basket (Fall '20)"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-sdk-exampledelete-a-child-product-from-the-basketfall20-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-exampledelete-a-child-product-from-the-basketfall20-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: afde52a8ef2cb14a7a7c185a96e95e353c11654a09a95fba3cbede926d149875
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: Delete a Child Product from the Basket (Fall '20)

Use the example SDK code in this topic to delete a child product from a basket.

```nolang
// Instantiate the input object for AddToCartInput to specify parameters
const input = digitalCommerce.createAddToCartInput();
input.catalogCode = "Mobiles"; // use your Catalog Code
input.basketAction = "DeleteChildProduct"; // deleting an offer that was added to cart
input.actionParams = {
  lineItemKey: "d83f475a776049d21054c105e9d53ee9", // use your lineItemKey
  cartContextkey: "d80b2927f07938aefdc7e2e349e2ede7", // use your cartContextKey
  bundleContextKey: "c3a4590a2d231e7022e04e5eba539ead" // use your bundleContextKey};
input.customFields = ["customAttribute__c"]; // optional field which returns custom fields for given keys

// Invoke Basket API via method addToBasket()
digitalCommerce
  .addToCart(input)
  .then(response => {
    Logger.info(
      "Vlocity digital commerce addToCart with basketAction=DeleteChildProduct for anonymous user: " +
        JSON.stringify(response)
    );
  })
  .catch(error => {
    Logger.info(
      "addToBasket with basketAction=DeleteChildProduct for anonymous user rest call failed" +
        error
    );
  });

```

Possible error conditions:

"AddToCartInput::getAPIPath() must have catalogCode."

"AddToCartInput::getAnonymousSiteRestUrl() must have catalogCode."

"AddToCartInput::getRequestPayload() must have basketAction."

"AddToCartInput::getRequestPayload() must have lineItemKey when basketAction is 'DeleteChildProduct'."

"AddToCartInput::getRequestPayload() must have cartContextkey when basketAction is 'DeleteChildProduct'."

"AddToCartInput::getRequestPayload() must have bundleContextKey when basketAction is 'DeleteChildProduct'."
