Cart commands and pipelines

Version:

The following table describes the commands and pipelines pertaining to the Cart entity:

Command/PipelineDescription
GetCartCommand

GetCartPipeline
Retrieves the cart record. If the cart does not exist it returns an empty cart.

Parameter:

  • cartId: the cart identifier (string)
Note

By default, the

GetCartPipeline recalculates the cart. In scenarios where cart calculation is not required, you can by-pass that cart calculation by including DoNotCalculateCart in the PolicyKeys header of the GetCart request.
MergeCartsCommand

MergeCartsPipeline
Merges two cart records. For example a customer initially creates a cart as an anonymous user, then authenticates and creates another cart. This action merges the previously anonymous cart into the authenticated cart and recalculates the cart.

Parameters:

  • fromCartId: cart record that data is merged from (string)
  • toCartId: cart record that data is merged to (string)
AddCartLinesCommand

AddCartLinesPipeline
Adds new cart lines but only re-calculates the cart once instead of for each line item added. When free gifts are added, the SelectFreeGiftsComponent is removed.

Parameters:

  • cartId: unique identifier for the cart.
  • itemId: identifier to the sellable item in the form <catalog>|<product_id>|<variant_id>
  • quantity: the quantity of cart line items to add (decimal).
  • isFreeGift: (optional) true if a free gift is being added, otherwise false (or omitted).
  • subLines: sub-lines to be added as part of line items.  Used for both static and dynamic bundles.
AddEmailToCartCommand

AddEmailToCartPipeline
Adds the shopper email to the cart.

Parameters:

  • cartID: the unique identifier for the cart.
  • email: email address associated with the cart.
UpdateCartLineCommand

UpdateCartLinePipeline
Updates a cart line within a Cart, for example updates its identifier or quantity, and recalculates the cart.

Parameters:

  • cartId: the unique identifier for the cart (string)
  • cartLineId: the unique identifier for the cart line (string)
  • quantity: the quantity of cart line items to add (decimal)
RemoveCartLineCommand

RemoveCartLinePipeline
Removes a single cart line from a Cart. Recalculates the cart.

Parameters:

  • cartId: the unique identifier for the cart (string)
  • cartLineId: the unique identifier for the cart line (string)

The following are general pipelines that extend other cart pipelines:

  • CalculateCartPipeline
  • CalculateCartLinesPipeline
  • GetCartPipeline
  • GetCartListPipeline
  • PopulateLineItemPipeline
  • PopulateValidateCartPipeline
If you have suggestions for improving this article, let us know!