Newer Version Available
Commerce Webstore Cart, Preserve
To use this API, pass the guest session cookies in the request as part of the authenticated user session. For more information, see Set Up Guest Checkout for Headless Commerce Stores.
When a guest adds products to their cart and logs into a store, this API creates a new authorized cart and transfers the contents and coupons of the guest cart to the authorized cart. The API doesn’t transfer delivery or tax calculation details, or custom fields.
After the guest cart contents are successfully preserved, the guest cart is deleted. If the customer previously added items to their cart while logged in, the new authorized cart becomes the primary cart, and the previous cart becomes a secondary cart.
If the Preserve Guest Carts feature is turned off, if the guest cart is empty, or if the guest cart belongs to a different browser than the one the customer uses to log in, the API results in no operation and returns an empty response. Preserve Guest Carts is enabled by default in stores created after the Spring '24 release.
- Resource
-
1/commerce/webstores/webstoreId/carts/cartStateOrId/actions/preserve - Available version
- 60.0
- HTTP methods
- POST
- Request parameters for POST
-
- Response body for POST
- Preserve Cart Output