This code enables you to add a 2nd price for each simple product and product variation. The 2nd price is displayed for logged in users with the custom role named wholesaler. Everyone else is displayed the regular price.
Add different price for simple products in woocommerce :
Add different prices for variable products in woocommerce :
Different Price Per Product Based on Role
In this example we use the code to create a custom role for wholesale customers and add a price field to all simple product and product variations which is displayed when users with the wholesaler role login and browse products. When logged out, the regular price is shown.
Installation
Install the zip folder as a new plugin or copy & paste the PHP code from the functions file to the end of your child themes functions.php file or custom functionality plugin.
You must be logged in to post a comment.