---
schema_version: "1"
id: c7972806dab496810e483ae7eb9480ee577592df98e787db670d7962d205b443
title: "SDK Example: Add to Cart with No Configuration Changes (Fall '19)"
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-changesfall19-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-exampleadd-to-cart-with-no-configuration-changesfall19-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: afa2e7b4a3dcfbacaf956556dc2636005151eeac6e827ad32c25604735948f0a
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: Add to Cart with No Configuration Changes (Fall '19)

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'."
