Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Merging Public Carts

Merging Public Carts

Cortex API does not persist public carts. If a public user adds items to their cart and then authenticates, the cart's contents are lost. To merge a public user's cart with a registered user's cart, provide the public user's access token during the authentication process.

Merging a public cart with a registered user's cart

  1. Construct a POST request to the OAuth2 Resource, set the content-type to application/x-www-form-urlencoded, and add the PUBLIC access token to your request headers as shown in the example below:
    Content-Type: application/x-www-form-urlencoded
    Authorization: Bearer a9256d79-9273-4820-b45d-587f90d1dc9b
  2. Include the following parameters in the request body:
  3. Cortex API authenticates the request, merges the carts, and returns either a success or failure HTTP response. Successful authentication returns the following HTTP response:
       "access_token": "c7326d79-9273-4820-b45d-587f90d1dc9b",
       "expires_in": 359,
       "scope" : "MOBEE",
       "role": "REGISTERED"
    Unsuccessful authentication returns a 401 status code and an error message.