Policy keys
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.
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 |
IgnorePricing |
Sets a flag so that sellable item pricing is not returned when the |
IgnoreIndexUpdatedSitecoreItem |
Sets a flag to skip the Passed in:
|
IgnoreAddEntityToIndexList |
Sets a flag to skip the Passed in:
|
IgnoreLocalizeEntity |
Sets a flag to skip the Passed in:
|
IgnoreIndexDeletedSitecoreItem |
Sets a flag to ignore the Passed in:
|
DoNotCalculateCart |
Indicates that the cart should not be recalculated. Passed in:
|
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:
|
IgnoreSampleData |
During the environment initialization, prevents loading the sample data for the given environment. Passed in:
|
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:
|
MinionFault |
Sets a flag to listen for errors when testing or troubleshooting running minions. Passed in:
|