Curious case of Abandoned Cart – Sitecore Commerce

Sitecore Commerce comes with lot of analytics tools/reports which are specific to commerce. If you are not aware of what all comes OOB, you can check out my session here

Now you are aware of what all comes with Sitecore Commerce for analytics and one of them is Abandoned Cart Marketing Automation campaign.

While we tried to set this up for one of the project, we faced few challenges. You should be aware of these if you are planning to use Abandoned Cart feature to avoid any of issues mentioned here.

#Issue 1: Live event is not configured

Contact will be enrolled to automation plan on any of the activity like Add/Remove/Edit cart line. And specific page events are being raised based on operation user performs. This page events will be checked against contact to determine if contact’s cart has been manipulated or not in custom listener

We need to configure page events as live event which is specified below:

Why above page events are not configured as live event by default then?

#Issue 2: Missing config files

We observed this issue on higher environment while it was working fine in local. After making sure it works in local it was difficult to troubleshoot on higher environment as we were not seeing any error in Content Delivery (from where user enrolls into campaign on any of the shopping cart activity like add/edit/remove from cart) and Marketing Automation Engine.

From showconfig, we came to know that Marketing Automation campaign related configs were missing from the Content Delivery role.

Sitecore Commerce Marketing Automation Core OnPrem

Above package comes as part of commerce installation package. It will be different based on Sitecore commerce version and installation type weather OnPrem or cloud.

This package contains all the capabilities related to Marketing Automation for Cart and Order.

You need to make sure this is installed on CM as well CD roles in your installation scripts if you are modifying scripts for scaled version.

This config file contains all the patches to the pipelines which are responsible to add/remove user to/from Marketing Automation campaign.

<configuration xmlns:patch="">

    <cartAutomationPlanCustomValueProvider type="Sitecore.Commerce.MarketingAutomation.Providers.CartAutomationPlanCustomValuesProvider, Sitecore.Commerce.Connect.MarketingAutomation" singleInstance="true" />


        <processor type="Sitecore.Commerce.MarketingAutomation.Pipelines.Carts.Common.UpdateVisitorInAutomationPlan, Sitecore.Commerce.Connect.MarketingAutomation">
          <param ref="cartAutomationPlanCustomValueProvider" />
          <basePlanName>Abandoned Cart</basePlanName>

        <processor type="Sitecore.Commerce.MarketingAutomation.Pipelines.Carts.Common.UpdateVisitorInAutomationPlan, Sitecore.Commerce.Connect.MarketingAutomation">
          <param ref="cartAutomationPlanCustomValueProvider" />
          <basePlanName>Abandoned Cart</basePlanName>

        <processor type="Sitecore.Commerce.MarketingAutomation.Pipelines.Carts.Common.UpdateVisitorInAutomationPlan, Sitecore.Commerce.Connect.MarketingAutomation">
          <param ref="cartAutomationPlanCustomValueProvider" />
          <basePlanName>Abandoned Cart</basePlanName>


So, without this configs these processors were not getting called at all and we were not seeing any errors in any of the role which is difficult to troubleshoot.

#Issue 3: Incorrect Campaign Name

When we select Commerce Abandoned Cart MA Campaign module while creating new Storefront site as part of installation, it creates campaign with name Storefront Abandoned Cart.

Starting point in MA campaign define how contacts should be enrolled in automation campaign. When we see starting point of the Abandoned Cart Marketing Automation campaign, Top Level Commerce Campaign goal is selected. So, based on this contact should be enrolled when user hits this goal which must be getting called during shopping cart activity.

But that’s not the case, after digging into UpdateVisitorInAutomationPlan processor, it came out that instead of raising above goal, contact is getting enrolled into automation plan based on plan name. And this plan name needs to be in specific way which is [Shop Name]+” “+[Base Plan Name]. Shop Name which will be generally your site name and Base Plan Name specified in above config which is Abandoned Cart separated by space.

And it’s very difficult to find this in documentation so you might end up spending lot of time figuring out what’s happening unless you check processor mentioned.

We had not followed this naming convention while creating custom automation plans for our shops which was causing the issue.

#Issue 4: Plan Name v/s Alias

After solving above issue of having wrong plan name, we were hopeful of everything works fine.

But to our surprise, still it was not working and contacts were not getting enrolled in automation plan.

So, we tried to override AutomationProvider and AutomationPlanProvider which are responsible of getting automation plan using above name in UpdateVisitorInAutomationPlan processor.

In above implementation, it’s trying to fetch automation plan by alias using below API

So, what do we refer as alias in automation plans?

So, we went ahead to check our custom automation plan’s alias at /sitecore/system/Marketing Control Panel/Automation Plans location in Marketing Control Panel.

Value of the Name field was correct and which we were also able to see in MA plan as per expected naming convention [Shop Name]+” “+[Base Plan Name]. But Item Name was having GUID appended.

We had to remove GUID from Item Name and need to make sure Item Name follows naming conventions mentioned above to make it work after deploying marketing definitions.

#Issue 5: Unauthenticated user

Till Sitecore Commerce 9.2, Abandoned cart functionality was only working for authenticated users. So, if you are trying to do all shopping cart activity after fixing above issues as guest user, it will still not work.

If you want to make it work for unauthenticated but identified user, you will have to override UpdateVisitorInAutomationPlan processor and patch custom processor wherever this processor is getting used:
In custom processor, you need to remove a condition where it checks for user authentication.

In Sitecore 9.3, It’s also possible to enable abandoned cart functionality for unauthenticated user. You can do this using allowUnauthenticatedContacts param in above config with UpdateVisitorInAutomationPlan processor. Also you can enable multiple time enrollment of same contact in one plan by using allowDuplicateContacts param.

        <processor type="Sitecore.Commerce.MarketingAutomation.Pipelines.Carts.Common.UpdateVisitorInAutomationPlan, Sitecore.Commerce.Connect.MarketingAutomation">
          <param ref="cartAutomationPlanCustomValueProvider" />

For this to work with unauthenticated user, user must be identified. Contact information is captured and identified when the customer enters an email address, for example, on the Billing page.

Support for anonymous customers is provided by the SetAnonymousPreferredEmail processor in the UpdateCart pipeline.

More information here:

So, all these are small issues but if you are not aware you will end up spending lot more time.

Everything about Lists in Sitecore Commerce

So you have started working on Sitecore Commerce? and also started exploring Minion? If so, then you must have heard term Lists (ManagedLists). I was having hard times initially understanding how it works due to limited documentation around this feature. Except few good articles below (based on my skill to google):

So, here i am trying to consolidate everything you might want to know about Lists in Sitecore Commerce.

Importance of Lists

Lists does not only meant to be used by Minion. It could be used everywhere where you need to save reference to entity. And wanted to retrieve those references quickly instead of searching in the entities itself. For ex: User’s Orders, Orders based on status, indexing etc. In short, all those processes where you need to do bulk operation on entities, you can utilize the Lists and if needed can combine with Minion.

Continue reading “Everything about Lists in Sitecore Commerce”

Debugging Sitecore Commerce Engine

While working on Sitecore commerce project, at many point of time we would like to debug the commerce part of the application similar to as we used to debug the Sitecore solution. To be able to debug the Sitecore commerce engine, there are couple of key concepts to understand. Which will help you understand the connection and debug commerce engine effectively.

If you are not much familiar with Commerce Engine, please see Getting started with Sitecore Commerce

I have used Sitecore Commerce 9.2 version to perform all these debugging steps.


To debug commerce engine, you fist need to know how authentication works for different systems like Business Tools, Storefront, Content Editor, Postman etc.

Continue reading “Debugging Sitecore Commerce Engine”

Deploying Sitecore Commerce Engine using TeamCity and Octopus

We are seeing a lot of evolvement around DevOps for Sitecore. As part of that i have been working on many projects where we have implemented CI/CD along with some complexity like xConnect deployment, Deployment to Marketing Automation jobs, Blue-Green deployment. Currently, i am working on a Sitecore Commerce project. We are using 9.2 version of both Sitecore and Commerce. Where we had already implemented CI/CD for Sitecore solution. Now, we wanted to do it for the Commerce as well.

If you are not aware about Commerce basics like Role, Databases, Indexes etc. Please look at my previous blog here.

Continue reading “Deploying Sitecore Commerce Engine using TeamCity and Octopus”

Getting Started with Sitecore Commerce

Recently, I got a chance to look at Sitecore Commerce. So, i will be sharing my understanding after self learning and looking into real world project of commerce for few weeks. I hope this will be helpful for those wanted to get started on commerce.

Getting Started with Commerce


Along with standard XM/XP roles, there are few other roles created with commerce installation. They are:

  • SitecoreBizFx: Sitecore Business Tools – In simple words, admin panel for managing all features like Customers, Prices and Promotions, Inventory, Orders etc. It’s data driven applications built on Angular and Knockout. You will find config.json in SitecoreBizFx role which will have important configurations to connect to identity server and commerce engine.
    2019-08-11 14_25_13-NEW-LIXIL-VM (Lixil - Sc9.0.2 installed) [Running] - Oracle VM VirtualBox _ 1
  • Engine Roles
    There are different kind of commerce engine roles being created when you install commerce. They share many similarities thus it’s important to understand what each role is responsible for.

    • Ops: The Ops role is an instance of the Commerce Engine that is internal and only available to DevOps personnel. This role can have an identity with higher privileges allowing DevOps personnel to perform maintenance tasks that are not permitted to other roles (e.g., bootstrapping and environment initialization functions).
      For more information on setting up postman for Sitecore commerce API calls:

    • Authoring: The Authoring role is the instance of the Commerce Engine that serves traffic from the Commerce business tools. For ex: Merchandising experience for managing Pricing and Promotions, CSR Experience for managing  Customers and Orders. Since this role serves lighter traffic (i.e., eCommerce solutions have relatively few business users compared to the number of shoppers), scale requirements are normally relatively low. As this role is being used by business tools means SitecoreBizFx role as mentioned above, you will find “EngineUri”: “https://localhost:5000&#8221; configuration in config.json of SitecoreBizFx role.
      2019-08-11 14_47_32-NEW-LIXIL-VM (Lixil - Sc9.0.2 installed) [Running] - Oracle VM VirtualBox _ 1
    • Shops: The Shops role is the instance of the Commerce Engine that serves traffic from one or more storefronts. This role is intended to scale to support demand, and is usually installed in close proximity to the Sitecore Experience Platform instances that generate the traffic. To scale the solution, the Sitecore XP instances and/or the Commerce Engine instances can be scaled depending on traffic mix and the location of any bottlenecks. Shops role which is connected to CD role is generally responsible for services like Shopping cart services, Order services, Customer Self Service etc.
      2019-08-11 14_58_11-NEW-LIXIL-VM (Lixil - Sc9.0.2 installed) [Running] - Oracle VM VirtualBox _ 1
      You can see the configuration in your web role from config \App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config.
      2019-08-11 15_30_02-NEW-LIXIL-VM (Lixil - Sc9.0.2 installed) [Running] - Oracle VM VirtualBox _ 1
      But we couldn’t find https://localhost:5005/ which is shop role in any of configuration in standard installation (also mentioned in
      Scaled: For scaled XP environment where you will have separate CM and CD, shopServiceUrl will point to authoring role in CM while in CD it will be pointed to shops role.
      You can find scripts written by our community members for scaled XC installation here.
      2019-08-11 15_36_34-Sitecore-Commerce-v902-Scaled-Installation_Deploy-Sitecore-Commerce-SitecorePack
    • Minions: The Minions role is an instance of the Commerce Engine that runs independently and supports asynchronous processing. This includes any post-order capture processing as well as any cleanup or pruning.
      2019-08-11 15_44_30-Microsoft Edge
      Minion role is not connected directly to any of role like Web, Authoring, Shops etc. It is just connected to commerce database directly.


SXA Storefront is a framework that enables you to create a shop experience easily and quickly. SXA Storefront is built on top of Sitecore Experience Accelerator along with many commerce specific components.

It uses all core feature of SXA like page designs, partial designs, renderings, renderings variants etc.

When you install commerce, by default it installs a storefront site for you. And if you want to create it yourself the you can create it same as normal SXA site by clicking on tenant and adding new site through create site dialog.

2019-08-11 17_05_15-NEW-LIXIL-VM (Lixil - Sc9.0.2 installed) [Running] - Oracle VM VirtualBox _ 1
Here, you can find three modules specific to commerce.
Commerce Storefront Components:  provides the SXA Toolbox renderings and Sitecore Commerce Control Panel. With this checked, you will see additional commerce specific renderings in toolbox:
To understand more about each sections and renderings into each sections visit Commerce Account renderings, Commerce Cart renderings, Commerce Catalog renderings, Commerce Checkout renderings, Commerce Orders renderings, Commerce Shared renderings, and Commerce meta renderings
Commerce Storefront Template: provides storefront templates and pages. For ex: Shopping cart, Checkout, Account pages etc. And also it comes with default partial designs and page designs for different kind of pages.
page designs

Page design and partial design relation
page-partial designs
Commerce Storefront Habitat Catalog: provides a sample catalog with categories and sellable items.

Note: There are few changes related to catalog since Commerce 9.0.2. They are:

  • The default Catalog and Start Navigation Category are now configured from under “{site}/settings/commerce/catalog configuration”. This is in order to avoid references from the Global Control Panel settings to specific sites after the catalog content has been moved under the specific sites where it belongs. The old location under Commerce Control Panel is still supported to provide backward compatibility.
  • Catalogs are now incorporated into the content area of the storefront sites and reside under a new “{tenant}/{site}/{home}/catalogs” item where it’s used and belongs. This fixes multiple issues including:
    1. Limited access to the catalog for non-admin Sitecore users.
    2. The same products appearing in multiple locations in content with the same item ID and path, causing problems in different places.
    3. Not being able to set and store Sitecore specific settings and data like personalization, presentation and workflow on catalog items and have it persisted correctly and uniquely.

2019-08-11 17_29_47-NEW-LIXIL-VM (Lixil - Sc9.0.2 installed) [Running] - Oracle VM VirtualBox _ 1

While creating a new site, we can create our own theme for commerce storefront. Storefront Branded is a sample storefront theme which you can use as an example or base when creating theme for your newly storefront.

Commerce Base Themes: Prior to the 9.0.3 release of Sitecore, JavaScript for commerce functionality was loaded using the AssetService pipeline (processor Sitecore.Comerce.XA.Foundation.Common.Pipelines.AssetService.AddJavascript).

To improve performance and multi-site extensibility, all JavaScripts supporting commerce business functionality have been moved from files on disk to the sitecore/Media Library/Base Themes folder.

  • Commerce Core Libraries: This theme contains the third-party libraries used by Storefront components (such as KnockoutJS, jQuery, Bootstrap, and so on) Knockout is the main framework used in SXA Storefront for data binding.
  • Commerce Services Theme: This theme contains the shared services used by all Storefront components (such as the Ajax service used to handle the Ajax calls to the API). This theme also contains the communication and messaging logic between the components that follow the publisher-subscriber pattern.
  • Commerce Core Theme: This is the Foundation layer that contains the common JS logic used by all the components. It contains the application logic, component definition, and initialization.
  • Commerce Main Theme: This theme contains the main.js file that represents the entry point to the Storefront front-end application initialization.
  • Commerce Components Theme: This theme represents the Feature layer and it contains all the component-specific logic. Each Storefront component has its own JavaScript file named after the component that handles its initialization, data bindings, and some of the interactions between the user and the component.


The Commerce Engine delivers commerce functionality through an extensible, pluggable framework. A plugin is an independently publishable extension to the Commerce Engine.

Your commerce solution with plugin may look something like:
2019-08-11 23_50_20-Training - Microsoft Visual Studio

Sitecore.Commerce.Engine: This is the main project of your commerce solution built on .Net Core framework. All the Plugins being created and added into solution will be referenced into this project. All projects from Feature.SDK folder are plugins. Sitecore.Commerce.Engine project also contains different JSON configurations and Policy files. Sitecore.Commerce.Engine project gets deployed to all commerce engine roles mentioned earlier in this post.

There are already few good posts written by community members. You can go through those to understand more about plugin architecture.

Click here to know more about Plugin

Click here for instructions on creating your first Plugin

Click here for getting the customer sample solution up and running

Click here to understand all entities which comes together and forms a complete Plugin

Click here to understand how to remove sample plugins from customer sample solutions and start with fresh solution for your project

Service Proxy: As we know now, data is being exchanged using OData protocol. And as per Helix guidelines and Commerce architecture, we created plugin and it’s endpoints with implementation in .Net Core project while we creates normal MVC project for our feature. Now, if we need to reference such endpoints and models which we created into plugin in feature project, we cannot reference .Net Core project into feature. That is where Proxy comes into the picture.

Click here to know more about what is service proxy

Click here to understand how service proxy works

Click here to know how to generate service proxy with latest OData package




Sitecore Habitat Home installation – Build Error & PackageReference

Currently, i am starting a new project which is based on eCommerce solution build in legacy .net platform which i need to move to Sitecore. I wanted to have a look at all the solutions & structures available in community like Habitat, Sitecore Commerce 9.0.2 (A storefront example with the help of SXA), Habitat Home Demo.

I have already configured Habitat solution many times in local or on server without visual studio installed. I also installed Sitecore Commerce 9.0.2 with the help of installation guide provided by Sitecore and an excellent blog by @viet_hoang_sc: . Now, it was turn for Habitat Home Demo.

Continue reading “Sitecore Habitat Home installation – Build Error & PackageReference”