Adding price variations depending on user logged in
I have setup in my variations 3 fields that will be the price changes to the product, each depending on the role of the user logged in. So in this case this would be a field for client_a, client_b or client_c that would contain the price increase if the user logged in is one of the 3 roles that I am looking for. For each of the roles one of the fields would be added to the price, the other two would be discarded.
I added these fields to my WC_Product_Variation class but now I need to be able to know which role is my user in order to apply the proper price. How whould I do this? Can I create a global variable with the role and pass it to the class? Is that something that can be done?
I need it that once the user adds the product to the card, the price should be the one with the added amount from the field, and that change should be in the database so that it is reflected everywhere else (emails, summary of orders, etc)
- The topic ‘Adding price variations depending on user logged in’ is closed to new replies.