The Shopping Cart service layer

Version: 10.2

The Commerce Connect core framework contains a number of abstract service layers. The Shopping Cart service layer is one of the most important service layers.

Operations in the Shopping Cart service layer API

The following table describes the operations contained in the Shopping Cart service layer.

Type of operation

Operations

Create, Read, Update, Delete (CRUD), and merge operations on a cart

CreateOrResumeCart*

DeleteCart* – not necessary to call if the cart turns into an order

UpdateCart*

SaveCart – typically not necessary to call explicitly as it is done indirectly by calling UpdateCart or updating cart lines

LoadCart

GetCarts – supports multiple carts per customer

MergeCart

CRUD operations on cart lines

AddCartLines*

UpdateCartLines*

RemoveCartLines*

CRUD operations on associated parties, for example, address and contact information

AddParties

UpdateParties

RemoveParties

Add and remove operations on associated shipping information

AddShippingInfo

RemoveShippingInfo

Add and remove operations on associated payment information

AddPaymentInfo

RemovePaymentInfo

Locking and unlocking cart

LockCart*

UnlockCart*

Note

All operations marked with an asterisk (*) trigger a unique page event that allows the contact interaction to be carefully tracked, making it possible to report and act on these operations. Most of the events include information about the cart ID and the added products.

The page events are installed when you install Commerce Connect.

User-case scenarios

The following illustrates basic shopping cart user-case scenarios:

Typical storefront usage of the shopping cart API is as follows:

  • When the contact first arrives at the webshop, the CreateOrResumeCart method is called to retrieve the cart and to show the cart content and total in a mini-cart.

  • If the contact has previously registered a profile and left a cart from previous visits, then the MergeCart method is called when the contact logs in.

  • As the contact starts to add products to the shopping cart, the AddCartLines method is called.

  • During the checkout process:

    • Shipping and billing addresses are added using the AddParties method.

    • Shipping information specifying method and referring to lines and parties is added using the AddShippingInfo method.

    • Payment information specifying method and referring to lines is added using the AddPaymentInfo method.

  • While processing the payment information and reserving money on credit cards, the cart is locked using the LockCart method.

For more detailed information, see the Commerce Connect Developer's Guide.

Cart-based rendering rule conditions

Commerce Connect includes three rendering rule conditions that can be used to personalize the contact experience based on the products in the cart, the cart total, and the quantity of products. The cart data is read live from the external commerce system, not from the marketing platform. The conditions can be combined in a rule in a number of different ways. For example:

  • Contains product: If [shopping cart contains product A] then …

  • Cart total: If [shopping cart total is > Y] then …

  • Item quantity: If [shopping cart total quantity of items > N] then …

  • A combination of the above: If [shopping cart contains more than N quantity of product A and cart total > Y] then …

The Abandoned Cart marketing automation campaign

Commerce Connect 9.0.2 and later contains a default Storefront Abandoned Cart marketing automation campaign that lets you track shopping carts and send emails to contacts when they abandon their cart.

The following code snippet is an example of how the Connect API handles the abandoned cart marketing automation plan.

RequestResponse
 var automationProvider = (IAutomationProvider)Factory.CreateObject("automationProvider", true);
            var shopName = <sitename>
            var template = "Abandoned Cart";
            automationProvider.CreateFromTemplate(shopName, template);

The New Order Placed marketing automation campaign

The following code snippet is an example of how the Connect API handles the new order placed marketing automation plan.

RequestResponse
 var automationProvider = (IAutomationProvider)Factory.CreateObject("automationProvider", true);
            var shopName = <sitename>
            var template = "New Order Placed";
            automationProvider.CreateFromTemplate(shopName, template);

Do you have some feedback for us?

If you have suggestions for improving this article,