---
schema_version: "1"
id: 497ea1f0f26e7b455b0518f137aef80e4e66d7a9ab165bc644b4247953502fa2
title: "SDK Example: Delete a Child Product from the Basket (Winter '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-basketwinter20-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-exampledelete-a-child-product-from-the-basketwinter20-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: d61875ccdcea8dadbb7279c154cf6892abf99df7f5da050380ff34b905b3fced
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: Delete a Child Product from the Basket (Winter '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'."
