---
schema_version: "1"
id: cb46ed94ae98e189f6eaeee86830d56bdf5b5ecc2a425209d67f045b1deda4dc
title: "SDK Example: Delete From 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-from-basketfall20-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-exampledelete-from-basketfall20-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b69ee2232e7bdcb061c6a91b0ead8d9cd787cf08a7a65174570ce8c155c0ce39
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: Delete From Basket (Fall '20)

Use the example SDK code in this topic to addToBasket with basketAction=DeleteFromBasket. The call must have deleteBundleNumber as an input parameter.

```nolang
// Instantiate the input object for the addToBasket method to specify parameters.
const input = digitalCommerce.createAddToBasketInput();
// Use your AWS gateway.
input.anonymousSiteUrl = "https://mubnr8cjgl.execute-api.us-west-2.amazonaws.com/prod/dc";
// Use your Catalog Code.
input.catalogCode = "Mobiles";
// Delete an offer that was added to basket.
input.basketAction = "DeleteFromBasket";
input.forceInvalidateCache = true;

// The basket item list grows from the bottom up. For example: if you add products A, B, and C in that order,
// the JSONResult.records list would be C,B,A with respective numbering as 0,1,2.
// The 0 item will always be the most recent addition.
input.deleteBundleNumber = 0;

// Invoke the Basket API via the addToBasket() method.
digitalCommerce
.addToBasket(input)
.then(response => {
  Logger.info(
    "Vlocity digital commerce addToBasket with basketAction=DeleteFromBasket for anonymous user: " +
      JSON.stringify(response)
  );
})
.catch(error => {
  Logger.info(
    "addToBasket with basketAction=DeleteFromBasket for anonymous user rest call failed" +
      error
  );
});
```

Possible error conditions:

"AddToBasketInput::getAPIPath() must have catalogCode."

"AddToBasketInput::getAnonymousRestUrl() must have anonymousSiteUrl."

"AddToBasketInput::getAnonymousSiteRestUrl() must have catalogCode."

"AddToBasketInput::getPostBody() must have basketAction."

"AddToBasketInput::getPostBody() must have deleteBundleNumber when basketAction is 'DeleteFromBasket'."
