After installing the Sitecore Experience Commerce by default we have a storefront with Commerce Engine which have a few plugins that is used in storefront site. Sitecore commerce Engine by default run on the Commerce Authoring site with https on port 5000.
In the Development when we need to create some plugin and extend the existing plugin we need to debug the engine as well. Developers can do so by using the Sitecore Commerce Engine SDK provided by the Sitecore by default in the Sitecore Experience Commerce installation package. This post assumes that you have already setup the storefront site. So, lets dig into it.
Step 1: Extract the Commerce Engine SDK
- Extract the Sitecore.Commerce.Engine.SDK.X.X.X.zip to a folder.
Step 2: Preparing the EDevelopmentnviornment
All the Commerce Engine based sites use https for the binding. So, in that scenarios we need to run our solution on https binding. Sitecore by default provides some scripts to export the certificates and use them in development.
Generate the SSL Certificates for the Development
- Go to the Scripts folder in the Sitecore.Commerce.Engine.SDK.*.*.*.
- Open the powershell in the Administrator Mode and execute the New- DevelopmentCertificate.ps1. This script will create the two new files(localhost.cer, localhost.pfx) in your Engine SDK wwwroot folder.
Setting Up the Certificate for the Authentication
Certificates are required for authenticate the request from trusted source. You need to follow teh below steps to configure this.
- Go to Commerce_Authoring website > wwwroot > config.json file.
- Find the thumbprint element from the Json file and copy it.
- Go to the Sitecore.Commerce.Engine project. Open the wwwroot > config.json file paste the above copied value and save the file.
Start the Solution debugging
- Stop the Commerce_Authoring site in the IIS running on the port 5000.
- Open the SDK solution in the Visual Studio.
- Change the debug profile to the Engine from the IIS Express
- Run the application. Now you can put the breakpoint in the current sdk code even you can see the console application which show the current pipelines and command running behind the scenes.