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

How to replace Woocommerce "Add to Cart" Button with a Cart Icon and Cart Icon along with custom text?
Using the below code I was able to change the Text of "Add to Cart" button Similarly, is it possible to replace Add to Cart Button with a Cart Icon or a Cart Icon with Custom Text?
Change "add to cart" button text if product is in cart and redirect to cart page when condition is met in WooCommerce
I'm looking for a solution when a user clicks on 'add to cart' button I already have some code but I am receiving a critical error in my WordPress block and just needed some guidance on what it could be. The code is working great in front end, but when I try to edit a page in wordpress, the hand-picked products block is stating there is an error. W...
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...
How does WooCommerce store products / product variations? / Free Script to import product variations?
So I'm just working for a client right now importing CSVs of products to WooCommerce. I've imported a lot of products so far using an existing plugin, but don't want to buy the CSV Product Import Suite for $99 to import product variations. So... Can anyone help me to answer one of the following two questions: Does anyone know a free WooCommerce plu...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.