Skip to content

Instantly share code, notes, and snippets.

@chrdesigner
Last active August 25, 2015 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrdesigner/e5e0908429c6ff67606d to your computer and use it in GitHub Desktop.
Save chrdesigner/e5e0908429c6ff67606d to your computer and use it in GitHub Desktop.
Function - Remove Loop/Single Button Add to Cart
<?php
/*
* Function - Remove Loop/Single Button Add to Cart
*/
add_action('init','remove_add_to_cart');
function remove_add_to_cart(){
if(is_user_logged_in()){}else{
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment