November Happy Hour will be moved to Thursday December 5th.

Customer Price Group Price not being applied to anonymous cart after user logs in

Vote:
 

Hi,

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!

-John

#152654
Aug 26, 2016 18:13
Vote:
 

Hi,

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.

Regards.

/Q

#152656
Aug 26, 2016 21:05
Vote:
 

Hi Quan Mai,

Thanks for the info! Looking forward to the fix. In the meantime, I will build a workaround.

Thanks!

John

#152659
Aug 26, 2016 21:13
Vote:
 

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.

Regards,

/Q

#153260
Aug 29, 2016 12:36
Vote:
 

Hi Quan Mai,

Great! Thanks again.

John

#154282
Aug 29, 2016 16:09
Vote:
 

Hi,

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 />";
                }
            }
            return returnString;
        }
        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);
                cart.AcceptChanges();
                actionResult.Success = true;
            }
            return actionResult;
        }

Thanks!

John 

#154834
Aug 31, 2016 4:40
Vote:
 

Hi,

Think you have to save the cart before running the workflow.

/Q

#154835
Aug 31, 2016 7:09
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.