I am running into an issue with Customer Price Groups and anonymous cart transfer after logging in. It is really easy to replicate. If a user is not logged in, and adds items to their cart, the items have the regular list price, as expected. If the user logs in and is part of the Customer Price Group, the cart that gets transferred over has the list price for the items instead of the Customer Price Group prices. On the cart page, I am running the CartValidate workflow, and I guess I expected it to see that the user is a part of the Customer Price Group and to recalculate the totals. That is not happening. Am I missing something, or do I have to write some custom logic to handle this?
Here are the versions I am running:
Any insight into this would be much appreciated!
It's very nice of you to include the versions of your site - that will greatly help.
The behavior you mentioned is indeed a bug - in ProfileModule. When a customer logs in, the current (anonymous) cart is merged with the current existing cart - but the prices are not updated. Normally it's not a problem, but in your case it's problematic. I'll file a bug on this and we will fix it in upcoming version.
Technically, you can replace the default implementation of ProfileModule - if you can't wait the bug to be fixed. Otherwise, you can try to re-set the prices of lineitems in cart before running CartValidate in cart page.
Hi Quan Mai,
Thanks for the info! Looking forward to the fix. In the meantime, I will build a workaround.
The bug is now fixed and targeting 9.23 release.
In the meanwhile, you can have a simple workaround by setting the Cart.ProviderId to "FrontEnd" before running CartValidateworkflow.
Great! Thanks again.
So, I wanted to do a quick follow-up regarding the workaround you suggested. I was setting Cart.ProviderId to "FrontEnd" each time I ran the ValidateCart workflow. That doesn't change anything with the cart transfer bug. Wondering if I may be missing something? Not sure if this will help, but here are my functions to call the workflow:
public static string RunWorkflowAndReturnFormattedMessage(Cart cart, string workflowName)
string returnString = string.Empty;
cart.ProviderId = "FrontEnd";
WorkflowResults results = cart.RunWorkflow(workflowName);
var resultsMessages = OrderGroupWorkflowManager.GetWarningsFromWorkflowResult(results);
if (resultsMessages.Count() > 0)
returnString = "";
foreach (string result in resultsMessages)
returnString += result + "<br />";
public CartActionResult ValidateCart(string name)
CartHelper ch = new CartHelper(name);
CartActionResult actionResult = new CartActionResult()
Success = false,
Message = ""
if (ch.IsEmpty == false)
var cart = ch.Cart;
actionResult.Message = RunWorkflowAndReturnFormattedMessage(cart, OrderGroupWorkflowManager.CartValidateWorkflowName);
actionResult.Success = true;
Think you have to save the cart before running the workflow.