Sitecore Commerce Engine Connect configuration

Current version: 10.0

The 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 Standalone or ContentDelivery or ContentManagement role), in the following location: \inetpub\wwwroot\<Sitecore>\App_Config\Include\Y.Commerce.Engine.

This topic lists and describes CE Connect configuration settings contained in each section of the Sitecore.Commerce.Engine.Connect.config file.

Note

The default values listed represent the values that are used when you install and deploy the sample Commerce solution.

Commerce Engine configuration

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

General CE Connect connector settings

Setting

Default value

Description

shopsServiceUrl

https://localhost:5000/api/

The URL of the Commerce Engine instance running the Shops service.

commerceOpsServiceUrl

https://localhost:5000/commerceops/

The URL of the Commerce Engine instance running the Commerce Ops service.

commerceMinionsServiceUrl

https://sxastorefront-identityserver

The URL of the Commerce Engine instance running the Commerce Minions service.

commerceEngineConnectClientId

CommerceEngineConnect

The 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.

commerceRequestTimeout

210

The 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.

enforceSsl

true

Enforces secure connection using SSL.

defaultEnvironment

HabitatAuthoring

The 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.

defaultMinionsEnvironment

HabitatMinions

Specifies the name of the default minions environment.

DefaultLanguage

en

The default language used when the HTTP request header does not specify a language.

defaultShopName

CommerceEngineDefaultStorefront

The storefront used by default when the HTTP header "ShopName" does not specify a value.

defaultShopCurrency

USD

The default currency used when the HTTP header "Currency" does not specify a value.

Catalog mappings settings

Setting

Default value

Description

getCatalogMappingsForIdsBatchSize

20

The number of IDs to fetch at a time when loading catalog mappings.

Catalog template fields generator settings

Setting

Default value

Description

useDeterministicFieldIdsForEntities

true

Controls 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.

useDeterministicFieldIdsForComponents

true

Controls 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

Setting

Default value

Description

defaultAuthoringDatabase

Master

Specifies 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

Setting

Default value

Description

fullIndexWaitTime

1000

Represents the number of milliseconds to wait before checking the status of the ItemFullIndexMinion command (a long running process).

incrementalIndexWaitTime

100

Represents the number of milliseconds to wait before checking the status of the incremental indexing command (a long running process).

fullCacheRefreshThreshold

20

The 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

Setting

Default value

Description

enabled

true

Enabled or disables the Redis cache provider for CE Connect caching.

cacheStoreName

Commerce-Connector-Redis

The name of the Redis cache store for the Commerce Connector.

intervalBetweenConnectionAttemptsInSeconds

60

The number of seconds between attempts to connect to the Redis cache provider.

configuration

localhost,

defaultDatabase=1,

allowAdmin=true,

syncTimeout=3600000

Redis configuration options.

instanceName

Redis

Name of the Redis instance.

Memory cache settings

Setting

Default value

Description

enabled

false

Controls whether to use in-memory caching.

cacheStoreName

Commerce-Connector-Memory

Name of the in-memory cache store.

cacheName

CommerceConnect

Name of the Commerce Connect cache.

expiration

21600000

Number 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 name

Description

"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 / Processor

Description

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/Method

Description

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:

Hook

Description

Sitecore.Commerce.Engine.Connect.Events.IndexingCompletedHook

Used 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:

Setting

Description

Sitecore.Services.SecurityPolicy

Sitecore 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:

Configurator

Description

Sitecore.Commerce.Engine.Connect.CachingConfigurator

Used 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.

Do you have some feedback for us?

If you have suggestions for improving this article,