Saturday, September 28, 2019

Sitecore Commerce 8.2.1 - Website Flow and how to debug the code.

Sitecore commerce 8.2.1 has two parts one is Sitecore and second is Microsoft commerce engine.

Here is a flow in IIS to deploy the Commerce engine and Sitecore website


How to setup the complete structure. First we need to generate a Proxy for the Commerce engine and need to add a reference of that proxy in main website

It will be like this -



The next step is to configure and register all dependencies,  It can be done in a simple way, Here is an example code -

 public class ConfigureSitecore : IConfigureSitecore
 {
     ///
     /// Configures the services.
     ///
     /// The services.
     public void ConfigureServices(IServiceCollection services)
     {
         var assembly = Assembly.GetExecutingAssembly();
         services.RegisterAllPipelineBlocks(assembly);

         RegisterIocBindings(services);
    }

     private static void RegisterIocBindings(IServiceCollection services)
     {
         services.AddTransient();
     }


 }

Here are a few sections of the API's



Now, that's all for the configuration, Whenever your website will hit to the cart and checkout or any module where you needs to trigger the commerce engine, Application will start the CommerecEngine and we can attach that to the debugger and can debug the commerce engine plugin code.