Woocommerce – Remove Add to cart button and add email link
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature.
Here we are with another blog post related to Woocommerce.
in this, we can let you that how you can remove Add to cart button/link and put the Email button with mail link instead of add to cart button.
as we see there are lots of people asking questions about it that how they can do this with a simple code of the snippet. So let’s start

First of all, you need to remove the Add to cart button from your website.

Go to your active theme function.php file which is located in your website’s active theme file.

Here’s the code for the same through which you can remove your Add to cart button/link.

Please take the backup of your previous file in case you do something wrong while customizing the current code Then you can Easily Backup your previous Code.

Please implement below code for remove Add to cart button/link:-

// For remove Add to cart button
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');

After you removed the Add to cart button/link from your website, now its time to put an email button with a link in there.

For this, you need to put the below code in the same file from where you removed the Add to cart button code. Just place the below code and save the file.

Here the code for add an email button with mail link:-

// add inquiry button into every product
add_action( 'woocommerce_after_shop_loop_item', 'prfx_add_inquiry_button', 10); // catalog page
add_action( 'woocommerce_single_product_summary', 'prfx_add_inquiry_button', 30); // single product page
function prfx_add_inquiry_button() {
$current_product_id = get_the_ID(); // get ID of the current post
$current_product_title = get_the_title(); // get the title of the current post
$product = wc_get_product( $current_product_id ); // get the product object
echo $current_product_title;
echo '<a href="mailto:test@example.com?subject=Inquiry for product id:$current_product_id" class="button">Inquiry</a>';
echo '</a>';

In this tutorial, I discussed how to hide, remove and disable Add to Cart button on Woocommerce. The process is very simple and the results could be cleanly achieved by adding small snippets of code at the proper locations. No matter which WooCommerce theme you are using,

So that’s it for now, Hope you guys like this. We will come up with another blog post soon. If you have any queries or any questions about this code snippets. Contact us for more information and follow us on LinkedIn, Facebook, and Instagram.