Archived topic
Login to view prices
5 replies · Started by Georgi on June 16, 2019
Hello,
Is there a way to make my shop hide prices and instead show a button "Login to view prices" or something along these lines?
Kind regards,
Georgi
Hi there,
this article provides the PHP snippet required to do that:
https://businessbloomer.com/woocommerce-hide-price-add-cart-logged-users/
Thank you, it worked.
However "Login to see prices" is displayed as text. Do you know how it can be turned to a button instead?
Kind regards,
Georgi
this line of code:
echo '<a href="' . get_permalink(wc_get_page_id('myaccount')) . '">' . __('Login to see prices', 'theme_name') . '</a>';
You can add a button class to the <a> tag like so:
echo '<a class="button" href="' . get_permalink(wc_get_page_id('myaccount')) . '">' . __('Login to see prices', 'theme_name') . '</a>';
Thank you, thank you so much! <3
Glad to be of help