Hey EntoMarket,
It is pretty easy add if you have a custom theme or access to your code. You just need to retrieve the relevant price by changing the name of customer to the role that you want to display.
<strong>Customer price:</strong> <?php echo get_post_meta( get_the_ID(), '_regular_price_customer', true ); ?>
Josh
Hey there, that is an easy line that is for sure.
Can I get a little more detail on where/how to add that ?
I also want to display regular price/wholesale price in the cart and on product pages.
I see the woocommerce product price function, in woocommerce.php and price.php but I suppose one would want to build a function that checks if they are a logged in wholesale user and if yes then show the price (of a non wholesale user).
I am just pretty scared to write that… any more elegant solutions to this ?
Thank you,
leif
@LCRoonQuist
The code give by @jshindler will not support for latest version..
for latest version kindly use the below code any where
Get Product’s Regular Price For Customer
<strong>Customer Regular Price:</strong> <?php echo do_shortcode('[wc_rbp id='99' role='customer' price='regular_price']');
Get Product’s Selling Price Based On Logged In User
<strong>Customer Selling Price:</strong> <?php echo do_shortcode('[wc_rbp id='99' role='customer' price='selling_price']');
Shortcode Variables Explained
-
id=99 you need to replace the 99 with your simple/variable product id
-
role=customer you need replace customer with your user role id / use current to get loggedin user role
- price use
regular_price or selling_price to get the value of each