The Commerce Engine is a thin ASP.NET Core application that serves as a host for a group of micro-services that enable commerce fqunctionality. These services are loosely coupled with each other and together, they provide a robust, extensible set of commerce-enabling services.
Services exposed from the engine are exposed as OData/REST based APIs. This enables either direct REST calls to the services, or calls through a generated smart proxy, which examines OData metadata and generates a strongly typed experience for accessing the service.
The initial out-of-the-box Commerce Engine is provided as part of the Sitecore XC SDK. It enables a developer to extend their solution by choosing which plugins are enabled in their solution.
The Commerce Engine provided in the SDK is called the Customer.Sample.Solution. You can open the Commerce solution in Visual Studio 2017. The SDK contains the Commerce Engine project itself and some sample plugins that demonstrate a typical extension of the solution.
Give your plugin a namespace and name.
Select the folder to add your plugin to.
In the following example, the plugin is added to the PluginSamples folder in SDK.
Do not try to add your plugin to a folder outside SDK, as the file paths can conflict with proper builds:
The system displays three errors (simple fix-up errors).
To fix the namespace error, accept the suggestion to change the path to Commerce.Core:
Once you have fixed the namespace error, fix the other three errors:
Follow the suggested fixes for the first two errors. For the third error, fix it by adding the following using to the ConfigureSitecoreclass:
your Visual Studio project should build successfully.
Once the plugin builds, you must add it to the Sitecore Commerce Engine project as a reference so that the plugin will be pulled in during a build/publish:
Expand the Commerce.Engineproject, right-click the Dependencies node, select Add Reference, and add a reference to your new project.
When the file is saved, it resolves the dependency and loads it when the application is launched.
Once you build the project, press F5to run the solution in debug mode as you did previously. The solution now pulls in your new plugin.
Happy plugin development ????
Contact us for more details firstname.lastname@example.org.