CartId naming conventions in Sitecore Commerce explained

Reading Time: 2 minutes

CartId is unique identifier that Sitecore Commerce Engine uses to unambiguously identify cart of current user.

Sitecore Commerce is prepared for having multiple carts per user. They are differed by their cart name.

SXA Storefront components use “Default” as name of the cart for every user / customer / buyer:


When you are doing requests through Postman, “Cart01” is used as cart name in sample collections:


How can Commerce Engine know for which user you are asking to have cart when calling LoadCart method from Commerce.Connect just by providing “Default” or “Cart01” or anything else as a name?

Answer is pretty simple.

Sitecore Commerce Engine Connect uses CartId to identify cart. This is handled itself under the hood for you.

There is a LoadCart processor in namespace Sitecore.Commerce.Engine.Connect.Pipelines.Carts in Sitecore.Commerce.Engine.dll that will shed some light for you / us.

It takes the LoadCartRequest with your cartId a.k.a. “Default” or “Cart01”. Let’s call this string CartName for the reminder of this article.

Then it extracts also UserId and ShopName from the very same request.

At the end these strings are combined together with this magic formula:

CartId = CartName + UserId + ShopName

CartId will be therefore always unique when processed by Sitecore Commerce.

If you provide different cart names when creating/loading cart, you can create solution where customers can have various carts at the same time. This will support scenarios where you need to have wishlist next to cart functionality. Wishlist will be just another cart in this scenario and you will use “Wishlist” as cart name instead of “Default” which will be used for “normal” shopping cart functionality.

Happy shopping!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.