The order emails in WooCommerce are rather bland or too generic from the users’ point of view. WooCommerce includes several order statuses that may not match your store’s flows, but you can still mark orders with custom status such as Payment Pending, Processing, On Hold, Failed, etc.
WooCommerce Hide Customer Order Email For Free Orders
While making impressive HTML emails is truly an achievement in itself, WooCommerce offers several options so that even WordPress beginners can create emails.
WooCommerce Customer Emails
“Vanilla” offers WooCommerce email notifications sent to customers in response to their interactions with the store. Here are the most important emails for the customers of your WooCommerce store:
- New Order
- Canceled Order
- Failed Order
- Order On hold
- Processing Order
- Completed Order
- Refunded Order
- Customer Invoice
- Customer Note
- Reset Password
- New Account
However, you can add customized emails as well. To check email notifications, go to WooCommerce > Settings and click on the Emails tab:
WooCommerce Hide Customer Order Emails for Free Orders
There are times when you sell free products to give customers access to registered members. This means you might not want to send them the “Order Completed” email, as your email marketing software does the follow-up work, or they are automatically redirected to the resource upon checkout.
You will want to keep the “Order Completed” emails for orders that are not $0. However, WooCommerce does not have this built-in functionality. We will use a custom PHP code snippet to achieve this.
Steps to Hide Customer Order Emails for Free Orders
Here are the steps that you need to follow:
- Log into your WordPress site and access the Dashboard as the admin user.
- From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file to hide customer order emails for free orders.
- Click anywhere on the text editor and scroll to the bottom of the functions.php file. Paste the code at the end:
/** * @snippet Disable Customer Order Email for Free Orders - WooCommerce */ // To target another email you can change the filter to e.g.: // "woocommerce_email_recipient_customer_processing_order" add_filter( 'woocommerce_email_recipient_customer_completed_order', 'njengah_disable_customer_order_email_if_free', 10, 2 ); function njengah_disable_customer_order_email_if_free( $recipient, $order ) { $page = $_GET['page'] = isset( $_GET['page'] ) ? $_GET['page'] : ''; if ( 'wc-settings' === $page ) { return $recipient; } if ( (float) $order->get_total() === '0.00' ) $recipient = ''; return $recipient; }
- Click on the Save changes button at the bottom of the text editor screen.
- You have successfully added the code snippet required to hide customer order emails for free orders.
Conclusion
In summary, this post shares how to hide customer order email for free orders. Moreover, I have highlighted some of the Email notifications supported by WooCommerce. However, you can add customized emails. If you are not familiar with code, please consider hiring a WordPress developer so that you do not break down your site.
Similar Articles
- How to Hide Errors From Visitors WooCommerce
- How to Setup WooCommerce Storefront Blog
- How to Hide Shipping Methods for Certain Conditions
- How to Add WooCommerce Storefront Sitemap
- How to Add WooCommerce Storefront Product Pagination
- How to Hide Weight of Product in WooCommerce
- How to Hide Price If Zero In WooCommerce
- How Add Text Before the Price in WooCommerce » Add Text Before Price
- How to Remove Cart Page WooCommerce Storefront Theme
- How to Hide WooCommerce Product from Search Results
- 5+ Useful Ways to Limit WordPress Excerpt Length Like a Pro
- How to Remove or Disable autop In WordPress Posts & Custom Post Types
- How to Check If Plugin is Active In WordPress [ 3 WAYS ]
- How to Hide Product Description Heading WooCommerce
- How to Hide Tax Label In WooCommerce
- How to Simplify Checkout Free Items Storefront Theme
- How to Redirect On Refresh WordPress Page » Detect Page Refresh PHP
- How to Hide Prices From Google In WooCommerce