How to hide the button "Add to cart" for the user, if it has a membership, I mean this is not an ordinary logged-in user, namely a member of a particular group, in this case just having a membership, without specifying a specific group... and display button if it does not has a membership. ?
Thought to do a simple check: If the person is logged in and if the value from the field in the database is equal to one, then execute the code at the link below, otherwise show the button. But how to write such a check in php? How to make the database was connected and checked what value?
function remove_loop_button(){
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 );
}
add_action('init','remove_loop_button');
Here's the code as if the delete button? http://pastebin.com/6mHybx2w