1. Configuration

Sitecore Commerce Engine Connect configuration

Version:

The default Sitecore.Commerce.Engine.Connect.config file contains configuration settings that influence the behavior of Commerce Engine (CE) Connect. CE Connect is the connector defined by C# classes that enables the integration between Sitecore Commerce Engine and Sitecore Commerce Connect — the core Sitecore XP commerce framework that exposes API(s) for storefront developers.

The Sitecore.Commerce.Engine.Connect.config file is stored in your Sitecore service instance (running as a Standalone or Content Delivery or Content Management role), in the following location: \inetpub\wwwroot\<Sitecore>\App_Config\Include\Y.Commerce.Engine.

Important

Do not make configuration changes directly in the Sitecore.Commerce.Engine.Connect.config file. To customize CE Connect configuration, use the [Custom.Commerce.Engine.Connect.config patch file](patching-sitecore-commerce-engine-connect-configuration.html "Patching Sitecore Commerce Engine Connect configuration"), or create your own patch file.

This topic lists and describes CE Connect configuration settings contained in each section of the Sitecore.Commerce.Engine.Connect.config file. The default values listed represent those used in the sample Commerce deployment.

Commerce Engine configuration

The <commerceEngineConfiguration> section in the Sitecore.Commerce.Engine.Connect.config file provides the following configuration settings:

General CE Connect connector settings

SettingDefault valueDescription
shopsServiceUrlhttps://localhost:5000/api/The URL of the Commerce Engine instance running the Shops service.
commerceOpsServiceUrlhttps://localhost:5000/commerceops/The URL of the Commerce Engine instance running the Commerce Ops service.
commerceMinionsServiceUrlhttps://sxastorefront-identityserverThe URL of the Commerce Engine instance running the Commerce Minions service.
commerceEngineConnectClientIdCommerceEngineConnectThe name of the Commerce Engine Connect client.
clientSecretHash<SecretHashValue>The hash that is used along with the client ID to authenticate to the Identity Server and get a security token. Connect then uses the token to authenticate to CE.
commerceRequestTimeout210The value (in seconds) used to set the HttpWebRequest.Timeout property when making HttpWebRequest calls to the Commerce Engine.
Note

The value of the

commerceRequestTimeout is set in seconds, and the value of the HttpWebRequest.Timeout property is in milliseconds.
enforceSsltrueEnforces secure connection using SSL.
defaultEnvironmentHabitatAuthoringThe Commerce Environment to use by default in HTTP requests (such as InvokeHttpClientGet and InvokeHttpClientPost) when the HTTP request header "Environment" does not specify a target environment.
defaultMinionsEnvironmentHabitatMinionsSpecifies the name of the default minions environment.
DefaultLanguageenThe default language used when the HTTP request header does not specify a language.
defaultShopNameCommerceEngineDefaultStorefrontThe storefront used by default when the HTTP header "ShopName" does not specify a value.
defaultShopCurrencyUSDThe default currency used when the HTTP header "Currency" does not specify a value.

Catalog mappings settings

SettingDefault valueDescription
getCatalogMappingsForIdsBatchSize20The number of IDs to fetch at a time when loading catalog mappings.

Catalog template fields generator settings

SettingDefault valueDescription
useDeterministicFieldIdsForEntitiestrueControls whether to generate deterministic field identifiers for entities template fields. The Commerce Engine requires this setting to be set to true so that GUIDs are generated using an algorithm based on the path to the field, allowing them to remain the same.
useDeterministicFieldIdsForComponentstrueControls whether to generate deterministic field identifiers for component templates. The Commerce Engine requires this setting to be set to true so that GUIDs are generated using an algorithm based on the path to the field, allowing them to remain the same.

Commerce authoring environment settings

SettingDefault valueDescription
defaultAuthoringDatabaseMasterSpecifies which database to use for returning versions of Commerce entities. The Master database contains both published and unpublished versions. The Web database contains published versions of content.

Indexing settings

SettingDefault valueDescription
fullIndexWaitTime1000Represents the number of milliseconds to wait before checking the status of the ItemFullIndexMinion command (a long running process).
incrementalIndexWaitTime100Represents the number of milliseconds to wait before checking the status of the incremental indexing command (a long running process).
fullCacheRefreshThreshold20The number of new or changed items to index that triggers a full cache refresh after incremental indexing.

CE Connect caching configuration

The <commerceCachingConfiguration> section in the Sitecore.Commerce.Engine.Connect.config file contains the following cache settings:

Redis cache settings

SettingDefault valueDescription
enabledtrueEnabled or disables the Redis cache provider for CE Connect caching.
cacheStoreNameCommerce-Connector-RedisThe name of the Redis cache store for the Commerce Connector.
intervalBetweenConnectionAttemptsInSeconds60The number of seconds between attempts to connect to the Redis cache provider.
redisConnectionPoolSize1The number of connection to Redis in a pool.
redisCompressionEnabledtrueControls whether the Redis provider compresses cached data.
configurationlocalhost,

defaultDatabase=1,

allowAdmin=true,

syncTimeout=3600000
Redis configuration options.
instanceNameRedisName of the Redis instance.

Memory cache settings

SettingDefault valueDescription
enabledfalseControls whether to use in-memory caching.
cacheStoreNameCommerce-Connector-MemoryName of the in-memory cache store.
cacheNameCommerceConnectName of the Commerce Connect cache.
expiration21600000Number of seconds an item is cached.

Commands

The following table lists commands that are triggered from the Commerce ribbon, in the Sitecore Content Editor.

Command nameDescription
"commerce:generatecatalogdatatemplates"Generates the catalog data templates. Command trigged by the Update Data Templates button.
"commerce:deletecatalogdatatemplates"Deletes the catalog data templates. Command triggered by the Delete Data Templates button.
"commerce:refreshcache"Clears the following caches in the current Sitecore database (command triggered by the Refresh Commerce Cache button):

  • ItemCache
  • DataCache
  • StandardValuesCache
  • PathCache
  • ItemPathsCache
  • TemplateEngine is reset.

Pipelines

The CE Connect connector leverages extensibility points provided by the Sitecore pipeline framework to implement Commerce connector functionality. Pipelines that use the prefix commerce in their name are implemented entirely for CE Commerce functionality. Other Sitecore pipelines are extended with custom Commerce processors.

Pipeline / ProcessorDescription
commerce.viewaction.getentityview /

Sitecore.Commerce.Engine.Connect.Pipelines.ViewAction.GetEntityView
A CE Connect pipeline processor used to get an EntityView from the Commerce Engine.
commerce.viewaction.doaction /

Sitecore.Commerce.Engine.Connect.Pipelines.ViewAction.DoAction
A CE Connect pipeline processor used to get a DoAction from a Commerce Engine.
getContentEditorFields /

Sitecore.Commerce.Engine.Connect.SitecoreDataProvider.Pipelines.ContentEditor.CommerceContentEditorFieldsProcessor
A CE Connect pipeline processor called by Sitecore when displaying a Commerce item in the Content Editor. The processor hides fields from Commerce views based on metadata supplied from the EntityView that corresponds to this content item. For example, fields that are hidden from the Business Tools user interface (UI) should also be hidden when viewing the same item in the Content Editor UI.
renderContentEditor /

Sitecore.Commerce.Engine.Connect.DataProvider.Pipelines.SetCommerceEditorFormatter
Processor added to a Sitecore platform pipeline to set the Content Editor formatter to use Sitecore.Commerce.Engine.Connect.DataProvider.Pipelines.ContentEditor.CommerceEditorFormatter to display a Sitecore XC catalog in Sitecore Content Editor user interface.
getQueryState /

Sitecore.Commerce.Engine.Connect.DataProvider.Pipelines.ContentEditor.CommandStateProcessor
Sitecore processor that determines which commands are enabled for Commerce items.
getContentEditorWarnings /

Sitecore.Commerce.Engine.Connect.Pipelines.ValidateToken
Processor that extends a Sitecore pipeline to display a warning in the Content Editor if the security token CE Connect sends to the Commerce Engine is invalid or if SSL is not enabled.
getItemPersonalizationVisibility /

Sitecore.Commerce.Engine.Connect.Pipelines.PersonalizationVisibilityProcessor
Pipeline processor that ensures that the profile cards can be edited for items deriving from relevant Commerce catalog item templates.

Events

The following table lists events that CE Connect can generate:

Event/Handler/MethodDescription
publish:itemProcessing /

Sitecore.Commerce.Engine.Connect.Events.CatalogPublishingExcluderEvent /

CheckProcessing
Ensures that Sitecore publishing process does not publish Commerce Catalog Items. Catalog items are published when approved as the end of the approval workflow.
publish:end, publish:end:remote /

Sitecore.Commerce.Engine.Connect.Events.CommercePublishCacheRefresh /

ClearCache (for both events)
Ensures that the Commerce caches are refreshed upon publishing to the Web.
saved, item:deleting /

Sitecore.Commerce.Engine.Connect.Events.CommerceItemEventHandler /

OnItemSaved, OnItemDeleting
Removes the changed item from the Sitecore caches.
indexing:completed:remote /

Sitecore.Commerce.Engine.Connect.Events.IndexingCompletedEventHandler /

OnIndexingCompleted
Clears the Sitecore caches after indexing is completed.

Hooks

The following hook runs when Sitecore initializes:

HookDescription
Sitecore.Commerce.Engine.Connect.Events.IndexingCompletedHookUsed to subscribe to the indexing completed event, and associate that event with the Sitecore.Commerce.Engine.Connect.EventsIndexingCompletedEventHandler handler.

Settings

The Sitecore configuration is patched to apply the following setting:

SettingDescription
Sitecore.Services.SecurityPolicySitecore setting patched to use Sitecore.Services.Infrastructure.Web.Http.Security.ServicesOnPolicy to allow secure access to the Entity and ItemServices.

Services

The following configurator is used to modify Sitecore services collection:

ConfiguratorDescription
Sitecore.Commerce.Engine.Connect.CachingConfiguratorUsed to modify the Sitecore services collection (Microsoft.Extensions.DependencyInjection.IServiceCollection) to use the Sitecore.Commerce.Engine.Connect.CachingRepository, and to configure Sitecore to use Sitecore.Commerce.Engine.Connect.CommerceCacheOptionsSetup.
If you have suggestions for improving this article, let us know!