Creating a clean solution for Sitecore Commerce

Sitecore Commerce solution is not similar to regular Sitecore solution. Even Sitecore Commerce installation package provide us a sample Sitecore Commerce solution as well. But it contains multiple sample project as well. Usually, people don’t remove the existing sample project and start developing Sitecore Commerce component on top of that sample solution.

Its always better to remove unused project/code from your solution. So today I would tell you how can you remove the existing sample application from the sample Sitecore Commerce application/solution.

Step-1: Extract the zip file Sitecore.Commerce.Engine.SDK.2.2.72.zip. You can get this zipped file with the Sitecore Commerce 9.0.2 installation package. Move the extracted folder at your convenient folder (where ever you want to keep your Commerce solution in the file system).

Step-2: Rename the solution file as per your project name. Open this solution and build. It should not have any build error.

Step-3: Add below dependencies to the Commerce Engine (Sitecore.Commerce.Engine) project:

  • Sitecore.Commerce.Plugin.Coupons
  • Sitecore.Commerce.Plugin.Journaling
  • Sitecore.Commerce.Plugin.SQL
  • Sitecore.Commerce.Plugin.Tax

Now we need to correct our configuration. Remove/comment sample files referenced from the configuration files:

Step-4:

  1. PlugIn.Habitat.CommerceAuthoring-1.0.0.json: Remove reference of the Plugin.Sample.Customers.CsMigration.ProfilesSqlPolicy and Plugin.Sample.Customers.CsMigration.ProfilePropertiesMappingPolicy from this file.
    remove_sample_app_commerce_1
  2. Global.json: Remove/comment reference of the Plugin.Sample.Upgrade.MigrationPolicy and Plugin.Sample.Upgrade.MigrationSqlPolicy from this file:
    remove_sample_app_commerce_2

Step-5: Remove the below mentioned project from the commerce solution:

  1. Plugin.Sample.AdventureWorks
  2. Plugin.Sample.Customers.CsMigration
  3. Plugin.Sample.Customers.Upgrade
  4. Plugin.Sample.Habitat
  5. Plugin.Sample.Upgrade

Step-6: Clean and build the solution. It should build without error.

Now your commerce solution is ready for deployment.

Thanks !!!

Leave a comment