Load Cart

Developer tasks for using service method LoadCart.

LoadCart is used to recall a specific cart with a given Cart ID on the specified shop. This method returns the full cart object with all the associated cartlines .

At your visual studio solution setup:

  1. Reference the Sitecore.Commerce.Connect.CommerceServer and Sitecore.Commerce.dll.
  2. Pick the class in your solution where want to use this service method.
  3. Paste in the code below to use the service method.
    CartServiceProvider provider = new CartServiceProvider();
    // Should be set to a real user id.
    string userId = Guid.NewGuid().ToString("B");
    var request = new LoadCartByNameRequest("MyShop", "MyBasket", userId);
    var result = provider.LoadCart(request);