What I am trying to accomplish is :

If an anonymous user adds a product to the cart, I would like to display a message on the site that says : Login to check out

what I did is the following: Added a new rule with the event: After adding product to cart

Condition: Data comparison, Data to compare: site:current-user:roles, The value to compare the data with: anonymous user

Action: Show message on the site : Please Login or Sign Up in order to checkout

but the message still does not show if an anonymous user adds a product to the cart

3 Answers 3


OK things worked out when I changed the condition to : user has role and passed in the current user as a parameter

I would still love to know where I went wrong in my first approach


I think the condition check of current user has worked out.

But the rule which you have explained is fine.


Why don't you just use Commerce Checkout Redirect?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.