Created
September 30, 2013 14:07
-
-
Save claudiosanches/6764354 to your computer and use it in GitHub Desktop.
WooCommerce - Hide price and add-to-cart button for non-logged in users.
This file contains 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 | |
function woocommerce_template_loop_price() { | |
if ( is_user_logged_in() ) | |
woocommerce_get_template( 'loop/price.php' ); | |
} | |
function woocommerce_template_loop_add_to_cart() { | |
if ( is_user_logged_in() ) | |
woocommerce_get_template( 'loop/add-to-cart.php' ); | |
} | |
function woocommerce_template_single_price() { | |
if ( is_user_logged_in() ) | |
woocommerce_get_template( 'single-product/price.php' ); | |
} | |
function woocommerce_template_single_add_to_cart() { | |
global $product; | |
if ( is_user_logged_in() ) | |
do_action( 'woocommerce_' . $product->product_type . '_add_to_cart' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@designbyidi https://businessbloomer.com/woocommerce-hide-price-add-cart-logged-users/