Issue with "Login to See the Price" function for WooCommerce
-
Here is my website: https://communitysupportedseafood.com/
I have a function that replaces the the WooCommerce price, if a user is not logged in, to “Login to See the Price.”
This works fine until after a user logs in and goes back to the home page. The top bar still displays “Login” and the product prices display “Login to See the Price”. This only happens on the homepage. If a user goes to any other pages, the top bar and prices display correctly.
Does anyone have an idea why this is happening on the homepage?
Here is my function:
/* Users must login to see the price */ add_filter('woocommerce_get_price_html','members_only_price'); function members_only_price($price){ if(is_user_logged_in() ){ return $price; } else return '<a href="' . get_permalink(woocommerce_get_page_id('myaccount')) . '">Login</a> to see price!'; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Issue with "Login to See the Price" function for WooCommerce’ is closed to new replies.