Working with an external commerce system (ECS)

Cart integration can be done in four different ways:

  • The cart is only passed to the external commerce system (ECS) when submitting an order.

    If the integration is made against an ERP system, shopping cart functionality is typically not provided and needs to be handled elsewhere, for example, in Commerce Connect.

    In this case, the cart related pipelines only contain the default Commerce Connect provided processors. This is very easy to set up as no work is involved in creating the integration other than adding a pipeline in the Orders service layer, which will take the shopping cart as input for creating an order.

  • The cart is only saved in the ECS after each change (OnSave).

    This option is the default option and will minimize the number of calls to the external commerce system and improve performance. It will, however, be more difficult for the external commerce system to act upon updates made to the cart in Sitecore, such as making changes to cart lines when products are added to the cart. For example:

    • There might be a discount that needs to be added due to a sale or due to adding a bundled product or a certain combination of products triggering a discount.

    • There might be an additional free product that needs to be added due to a sale.

  • All cart actions are forwarded to the ECS (AddLine, UpdateCart, and so on). This option provides the most flexibility for advanced scenarios as explained previously, but it also makes more calls to the external commerce system, decreasing performance.

  • Cart data is only persisted in the ECS. In this case, you must remove the Commerce Connect specific processors from the pipelines mentioned in parentheses LoadCartFromEAState (LoadCart), SaveCartToEAState (SaveCart), FindCartInEAState & RunResumeCart (CreateOrResumeCart), DeleteCartFromEaState (deleteCart), and BuildQuery + ExecuteQuery (GetCarts).

You can find all configuration for the cart subsystem in the Sitecore.Commerce.Carts.config file. Here you will find all details for the entities, pipelines, and repositories used by the cart system.

The default cart entities for Commerce Connect only assume some of the basic cart information that will be used across all commerce systems; it is expected that you will need to extend these entities.

To extend any of the default entities, you create a new class that inherits from the appropriate type, and then patch the appropriate entity under <commerce.Entities> in the Sitecore.Commerce.Carts.config file.

Note

For more information, see the Commerce Connect Developer Reference.