Reputation: 11
Good day,
I need to hide the add to art button in WooCommerce, without affecting pricing or dropdowns and variations. I am using WPForms for the adding to cart and checking out and ONLY do not want to display the Add to Cart button anywhere on the site.
Thus far I have used this snippet to remove the Add to Cart from shop and product page:
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
This works until I add a variable product, where it hides the Add to Cart button, but also hides the variation dropdown, so I used this snippet:
remove_action('woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 );
This hides the Add to Cart button and displays the variation dropdown.
The problem is, both snippets do no work together, they basically override each other.
Is there a snippet that can help me please.
Upvotes: 0
Views: 1631
Reputation: 69
Does it matter how you hide it? If not, you can use CSS
a.add_to_cart_button.ajax_add_to_cart{
display:none;
}
Upvotes: 1