An error occurs when an anonymous visitor tries to visit a page with Sitecore Experience Commerce (SXC) related personalization rules applied. The error leads to an issue that the personalization rule is considered as true even if the conditions are not met. The following exception can be found in the log files:
ERROR Evaluation of condition failed. Rule item ID: Unknown, condition item ID: {9D3B7B5B-48BA-4B54-A522-166FFDEAC33D} Exception: System.InvalidOperationException Message: userId Source: Sitecore.Commerce.Engine.Connect at Sitecore.Commerce.Engine.Connect.Pipelines.Carts.GetCarts.Process(ServicePipelineArgs args) at (Object , Object ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) at Sitecore.Commerce.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args) at Sitecore.Commerce.Services.ServiceProvider.RunPipeline[TRequest,TResult](String pipelineName, TRequest request) at Sitecore.Commerce.Rules.Conditions.BaseCartMetricsCondition`1.Execute(T ruleContext) at Sitecore.Rules.Conditions.WhenCondition`1.Evaluate(T ruleContext, RuleStack stack) at Sitecore.Rules.RuleList`1.Run(T ruleContext, Boolean stopOnFirstMatching, Int32& executedRulesCount)
To resolve the issue, download and install the hotfix:
For Sitecore XC 9.1.0: SC Hotfix-333939-1.
Be aware that the hotfix was built for a specific Sitecore XC version, and must not be installed on other Sitecore XC versions or in combination with other hotfixes. In case any other hotfixes have already been installed on a certain Sitecore XC instance, send a request for a compatibility check to Sitecore Support.
Note that the ZIP file contents need to be extracted to locate installation instructions and related files inside. The hotfixes must be installed on a CM instance and then synced with other instances using standard development practices.