If your site provides functionality for working with multiple carts and favourites lists, enKod allows you to integrate such mechanics as well. To do this, you need to use identifiers (string) for carts/favourites when passing change events of these entities to enKod.
The identifiers for carts and favourites are optional, and if they are not passed, we assume that the work is done with the contact's default cart/favourite. The implication is that there may exist in parallel and independently on the account for a contact:
Parameter “cartId” is required to pass the cart identifier (data type - string). If this parameter is not passed - actions will be performed with default cart without identifier.
<script type="text/javascript"> ekEvents.push('productAdd', {productId: '...', cartId: '...'}); </script>
<script type="text/javascript"> ekEvents.push('productAdd', [{productId: '...', cartId: '...'}, {productId: '...', cartId: '...'}]); </script>
<script type="text/javascript"> ekEvents.push('productRemove', {productId: '...', cartId: '...'}); </script>
<script type="text/javascript"> ekEvents.push('productRemove', [{productId: '...', cartId: '...'}, {productId: '...', cartId: '...'}]); </script>
When passing multiple products with different cartId in one request - they will be grouped and written each to the appropriate cart. An example of such request:
<script type="text/javascript"> ekEvents.push('productAdd', [{productId: '...', cartId: '1'}, {productId: '...', cartId: '2'}]); </script>
Parameter “id” is required to pass the cart identifier (data type - string). If this parameter is not passed - actions will be performed with the default cart without identifier.
In the body of the request at the level with the parameters “cart” and “history” pass the parameter “id” to work with a specific cart:
{ "id": "...", "cart": {...}, "history": [...] }
Pass the body of the request with a single parameter “id” to work with a specific cart:
{ "id": "..." }
Parameter “favouriteId” is required to pass the identifier of the favourite (data type - string). If this parameter is not passed - actions will be performed with default favourite without identifier.
<script type="text/javascript"> ekEvents.push('productLike', {productId: '...', favouriteId: '...'}); </script>
<script type="text/javascript"> ekEvents.push('productLike', [{productId: '...', favouriteId: '...'}, {productId: '...', favouriteId: '...'}]); </script>
<script type="text/javascript"> ekEvents.push('productDislike', {productId: '...', favouriteId: '...'}); </script>
<script type="text/javascript"> ekEvents.push('productDislike', [{productId: '...', favouriteId: '...'}, {productId: '...', favouriteId: '...'}]); </script>
When passing multiple products with different favouriteId in one request - they will be grouped and written each to the corresponding favourite. An example of such a request:
<script type="text/javascript"> ekEvents.push('productLike', [{productId: '...', favouriteId: '1'}, {productId: '...', favouriteId: '2'}]); </script>
Parameter “id” is required to pass the identifier of the favourite (data type - string). If this parameter is not passed - actions will be performed with default favourite without identifier.
In the body of the request at the level with the “wishlist” and “history” parameters, pass the “id” parameter to handle a specific favourite:
{ "id": "...", "wishlist": {...}, "history": [...] }
Pass the request body with a single parameter “id” to handle a specific favourite:
{ "id": "..." }
For API method Contact data with mapping to system fields (POST /v1/subscribe/) the logic of work for cases with several carts/favourites depending on passed cartMergeMethod and favouriteMergeMethod parameters is as follows:
For the script method Capture the contact on any of the forms (login, registration, quick purchase)) logic of work for cases with several carts/favourites depending on passed cartMergeMethod and favouriteMergeMethod parameters is completely similar to API.
Contact 1
Contact 2
Merge via cartMergeMethod = merge, we get:
When working with a single cart after the order it is automatically cleared in the database. In the case of multiple carts, we cannot clear the cart automatically, because we do not know which of the several carts was purchased. You need to additionally pass a method to clear the cart whose order was placed (use the corresponding API method or script method).
Segmentation terms:
by default work with the cart/favourite with the most recent update date (update means the event of adding an item to cart/favourite). This can be either the default cart/favourite or one of the cart/favourite with an identifier.
At the same time dynamic content methods:
by default also return products from the cart/favourite with the most recent update date (by update we mean the event of adding a product to cart/favourite). This can be either the default cart/favourite or one of the carts/favourites with an identifier.
In order to display in an email content of all cart and all favourites in the email use methods:
Note that when using these constructs, the output is only sorted by the carts/favourites themselves, the products inside will not be sorted. The first to be retrieved will be the contents of the cart/favourite to which the product was the most recent addition of products, then the next by the date of update, etc.