Policy keys

Current version: 10.2

The Commerce Engine implements a PolicyKeys property that has flags as values. You use policy keys to set flags that specify which pipeline blocks are skipped during the execution of a request to the Commerce Engine.

Within a pipeline block, the mention of the PolicyTriggerConditionalPipelineBlock block (or the AsyncPolicyTriggerConditionalPipelineBlock block) identifies that pipeline block as conditional. You can override the execution of a conditional pipeline block by including a policy key defined as a string by the "ShouldNotRunPolicyTrigger" property value.

You can use policy keys explicitly, passing their values in headers. In the following code sample, the IndexUpdatedSitecoreItemBlock class implements the IgnoreIndexUpdatedSitecoreItem policy key. During the execution of a ImportCatalogs request, if the IgnoreIndexUpdatedSitecoreItem string is passed in the header, the IndexUpdatedSitecoreItemBlock block is skipped when the pipeline runs.

RequestResponse
public class IndexUpdatedSitecoreItemBlock : PolicyTriggerConditionalPipelineBlock<PersistEntityArgument, PersistEntityArgument>    
{
    public override string ShouldNotRunPolicyTrigger => "IgnoreIndexUpdatedSitecoreItem";

The Commerce Engine also makes an implicit usage of policy keys, where policy keys hard-coded within the engine allow pipeline blocks to be skipped. For example, during the execution of a GetCart request, the Commerce Engine adds the "IgnorePromotions" policy key to skip pipeline blocks that are unnecessary to the operation, for maximized performance.

Passing policy keys in headers

You can include the PolicyKeys property in some API request headers (as shown in this example using a Postman sample). You can also pass policy key headers in code, as part of the Commerce context (as shown in this example).

Header policy keys

The following table lists header policy keys defined in the Commerce Engine.

Policy key

Usage

IgnoreCaching

Sets a flag to bypass catalog item caching for most catalog operations and APIs.

IgnoreAvailability

Sets a flag so that sellable item availability is not returned when the IGetSellableItemPipeline pipeline is called.

IgnorePricing

Sets a flag so that sellable item pricing is not returned when the IGetSellableItemPipeline pipeline is called.

IgnoreIndexUpdatedSitecoreItem

Sets a flag to skip the IndexUpdatedSitecoreItemBlock block executed during the incremental update process of catalog entities in Sitecore search indexes.

Passed in:

  • ImportCatalogs requests (with or without publishing).

  • ImportLocalCatalogs requests.

IgnoreAddEntityToIndexList

Sets a flag to skip the AddEntityToIndexListBlock block executed during the incremental update process of catalog entities in Sitecore search indexes.

Passed in:

  • ImportCatalogs requests (with or without publishing).

  • ImportLocalCatalogs requests.

IgnoreLocalizeEntity

Sets a flag to skip the LocalizeEntityBlock block executed during the incremental update process of catalog entities in Sitecore search indexes.

Passed in:

  • ImportCatalogs requests (with or without publishing).

  • ImportLocalCatalogs requests.

IgnoreIndexDeletedSitecoreItem

Sets a flag to ignore the IndexUpdatedSitecoreItemBlock block executed during the incremental update process of catalog entities in Sitecore search indexes.

Passed in:

  • ImportCatalogs requests (with or without publishing).

  • ImportLocalCatalogs requests.

DoNotCalculateCart

Indicates that the cart should not be recalculated.

Passed in:

  • GetCartCommand requests.

IgnorePromotions

Sets a flag so that promotions associated with the sellable item are not returned until items are added to the cart. To improve performance, set this flag to true.

Passed in:

  • GetSellableItemSummary

  • GetSellableItem

  • GetBulkPrice

IgnoreSampleData

During the environment initialization, prevents loading the sample data for the given environment.

Passed in:

  • InitializeEnvironment() when the parameter "sampleData=True".

IgnoreVersioningEntity

Sets a flag to ignore entity versioning. Mostly used internally by the bulk catalog items import process. 

ZeroMinionDelay

Sets a flag to run the order processing minion immediately to commit the order instead of waiting to run at a predefined interval.

Passed in:

  • CreateOrder requests

MinionFault

Sets a flag to listen for errors when testing or troubleshooting running minions.

Passed in:

  • Run PendingOrder Minion request in Postman.

Do you have some feedback for us?

If you have suggestions for improving this article,