---
schema_version: "1"
id: 6e566af7fe2e5c34114614e82887b38589f506b257f559bb36cbfd35ef20b4c8
title: "SDK Example: Add a Configured Offer to the Cart (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-a-configured-offer-to-the-cartfall19-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-exampleadd-a-configured-offer-to-the-cartfall19-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 36b0721772b2c87fac34c589959cc37f9cf5b69a8d3c77ad1d3a8cb5b2d0ecbc
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: Add a Configured Offer to the Cart (Fall '19)

Use the example SDK code in this topic to add a previously configured offer to a cart.

````nolang
```javascript
    const addToCartInput = digitalCommerce.createAddToCartInput();
    addToCartInput.catalogCode = "Phones";
    addToCartInput.offerConfiguration = digitalCommerce.getSelectedOffer(offerCode);
    addToCartInput.customFields = ["customAttribute__c"]; // optional field which returns custom fields for given keys
    return digitalCommerce.addToCart(addToCartInput);
  })
  .then(addToCartResponse => {
    Logger.info(addToCartResponse.orderId);
  })
  .catch(error => {
    Logger.info("addToCart login user dual fail: " + error);
  });

````
