In a WooCommerce store, I have two roles: Customer and Professional. In the WooCommerce options, I have selected to display prices in the cart and checkout with taxes included.
Now, I need for the Professional role to have the opposite setting, that in the cart and checkout the prices are displayed without taxes included.
Is there a way to modify that option depending on the role? If it is possible to do so, is there a filter or a clue from which I can start researching?
I’ve tried this code snippet, but unfortunately, it is not working. I have a user role set for wholesale customers who will not be charged taxes. Would be great instead of buying a plugin!
Hi Todd, maybe https://www.businessbloomer.com/woocommerce-remove-tax-checkout-field-value-exists/ gets closer to what you’re looking for
You can definitely do that. First of all https://www.businessbloomer.com/disable-payment-gateway-specific-user-role-woocommerce/ should help you understand how to run a function only when a user has a certain role.
Second, you can “set” whatever WordPress option you like with the https://developer.wordpress.org/reference/hooks/pre_option_option/ filter
This is a similar scenario: https://www.businessbloomer.com/woocommerce-hide-out-of-stock-items-exception/
This code snippet should do the trick:
I’m unsure how you added the “Professional” role to your site, but this code snippet is assuming there is a capability called “professional”.