Created
November 13, 2025 18:08
-
-
Save endurtech/14e152c14fbbbdc309b4a652ee589fad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Hide Product Pricing for Logged-Out Users in WooCommerce | |
| // https://endurtech.com/hide-product-pricing-for-logged-out-users-in-woocommerce/ | |
| if( ! is_user_logged_in() ) | |
| { | |
| add_filter( 'woocommerce_get_price_html', 'woocommerce_hide_product_price' ); | |
| function woocommerce_hide_product_price( $price ) | |
| { | |
| return '<a href="' . get_permalink(wc_get_page_id('myaccount')) . '">' . __('Login to see prices', 'enfold-child') . '</a>'; | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment