I need to know how we can achieve this when the user changes its group to another customer group that has a different price.

This is working when the user logout and gets login again but I want to change the price or get the product price as per group by making the user not to logout and login again.

For example, there is 2 customer group 1. wholesale and 2. general.

Product A is 10$ for General and 8$ for Wholesale.

The first User is assigned to General and then the user is free to changes its group from MyAccount.

After the user changes its group from general to wholesale then the price of Product A should get change from 10$ to 8$.


  • Users cannot change group in My Account. Are you using some kind of third party extensions?
    – Jimmy
    Mar 18, 2021 at 7:36
  • No, we don't use any extension we just pass group_id with in the form. It's the same like we are programmatically change user groups on form submission. Mar 18, 2021 at 7:59
  • I'm talking about this the user is free to changes its group from MyAccount. This is not stock Magento, and now you are mentioning form, what am I missing here?
    – Jimmy
    Mar 18, 2021 at 8:01
  • Yes, you are right. We are using my account form and in that we allow users to change their groups according to condition. Even Admin changes the group of the user who is already login then he/she is unable to see the change. After getting user group change I am able to set or change the group of a user in session but the price of the product according to the group not change Mar 18, 2021 at 8:09
  • 1
    What I'm trying to say is if you validate all the prices after changing 1 customer group, and then different customers changing their groups at the same time, you will run into problems. So this is not recommended in my opinion.
    – Jimmy
    Mar 18, 2021 at 8:39

2 Answers 2


I got this how we can change product price after group get change


Namespace used: \Magento\Customer\Model\Session

Might this help someone

Happy coding


Sorry i can not post comments so this is flagged as an "answer"

Hello, I think i have the same use case. But have no idea where to put the code for the solution you posted. I think i need more code than you posted?

Can you elaborate more on this? Would he highly appreciated!

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.