Best practices for modifying the Commerce Engine
In most Commerce implementation, almost all customization to the Commerce Engine is achieved through the creation of new plugin assemblies, which are then referenced by the Commerce Engine.
In most development scenarios, modifications to the Sitecore.Commerce.Engine
project are typically limited to the following:
-
Modifications to Commerce Engine policies, which is typically achieved through configuration.
-
The registration of new plugins, or modification of existing ones, through dependency injection achieved with the plugin's ConfigureSitecore.cs file.
References within the Sitecore.Commerce.Engine project
When you create a new plugin, or customize an existing one, you must add a reference to the Sitecore.Commerce.Engine
project. Follow best practices when you add references to components in your Sitecore.Commerce.Engine
project:
-
Add references to Sitecore plugins by using the official Sitecore NuGet feeds.
-
Add references to third-party assemblies using via NuGet where possible.
-
Add references to custom plugins within your own solution using project references.
Considerations for configuring the global environment
The global.json
file is used to configure the global environment during bootstrapping, and contains the minimum configuration required to start and run the Commerce Engine.
Avoid making changes to the Global.json
file, except for modifying the "policies"
collection section, for example, to change a parameter value, or to add a new global configuration policy.
Best practices for creating custom entities
Starting with Sitecore XC 9.2, commerce entities (CommerceEntity
) have a GUID UniqueId
and an EntityId
string . When you create a custom commerce entity, Sitecore recommends that you do not include the GUID as part of the EntityId
value, as it can create ambiguity with the unique ID, potentially resulting in Not found error when searching for the entity.