Remove Add to Cart button in Woocommerce but keep variations
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.
Solutions
Does it matter how you hide it? If not, you can use CSS
a.add_to_cart_button.ajax_add_to_cart{
display:none;
}
Similar questions
Show "Add to cart button" but don't allow to add to cart for "out of stock" products
In my woocommerce I am willing to show products that are out of stock but I don't want to sell them. I would like to have custom "ask for availability" button for it with contact form on the popup (any solution similar to that would be great) I managed to change button title but how can I forbid to add product to the cart and show some contact form...
Change Add to Cart Button to View Cart Button after click in Woocommerce
I have a Wordpress website. I am using the Storefront theme for WooCommerce. I have ajax add to cart buttons enabled. When an Add to Cart button is clicked and a product is successfully added to the cart I would like the button to change to a View Cart button (change the text to "View Cart", and link to the cart). If possible I would also like to s...
Remove "?add-to-cart=product-id" from Add to Cart URL when on the Cart page
We use this type of Add to Cart URL on our site a lot of times: http://yourdomain.com/cart/?add-to-cart=25. The problem is after it redirects to the Cart page, if the client changes his/her mind and removes the recently added product, the Cart page loads and adds it again since "?add-to-cart=25" is on the URL. My question is is it possible to remov...
Also ask