---
schema_version: "1"
id: 7074033514038c6df3088d30dd061e9945da3e75d46f6a325217380a23f70734
title: "SDK Example: Add to Cart with No Configuration Changes (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-exampleadd-to-cart-with-no-configuration-changesfall20-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-exampleadd-to-cart-with-no-configuration-changesfall20-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 67c77e5ee27ef80d732935442bf11a094bfe4b839f6ba1090d58c5b4cf83649a
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: Add to Cart with No Configuration Changes (Fall '20)

Use the example SDK code in this topic to add an already configured item to a cart.

```nolang
// Instantiate the input object for addToCart to specify parameters
const input = digitalCommerce.createAddToCartInput();
input.catalogCode = "Mobiles"; // use your Catalog Code
input.basketAction = "AddWithNoConfig"; // adding an offer that has not been configured (no change in its json structure from getOfferDetails) to cart
input.offerCode = "iPhone8Offer"; // use your Offer Code to be added to cart
input.customFields = ["customAttribute__c"]; // optional field which returns custom fields for given keys

// Invoke Cart API via method addToCart()
digitalCommerce
  .addToCart(input)
  .then(response => {
    Logger.info(
      "Vlocity digital commerce addToCart with basketAction=AddWithNoConfig for anonymous user: " +
        JSON.stringify(response)
    );
    return response;
  })
  .catch(error => {
    Logger.error(
      "addToCart() with basketAction=AddWithNoConfig failed" + error
    );
  });

```

Possible error conditions:

"AddTocartInput::getAPIPath() must have catalogCode."

"AddTocartInput::getAnonymousSiteRestUrl() must have catalogCode."

"AddTocartInput::getRequestPayload() must have basketAction."

"AddTocartInput::getRequestPayload() must have offerCode."

"AddTocartInput::getRequestPayload() must have offer when basketAction is 'AddWithNoConfig'."
