Send Invoice depending on radio selection

I have added a set of radio buttons to my WooCommerce checkout page to give customers the option to choose whether they need an invoice with their order. Here is the HTML markup for the radio buttons:

<div class="form-row billing-radio">
<div class="radio-wrapper">
<input type="radio" id="need_invoice" name="billing_option" value="need_invoice">
<label for="need_invoice">Yes, I want an invoice</label><br>
<div class="radio-wrapper">
<input type="radio" id="no_invoice" name="billing_option" value="no_invoice" checked>
<label for="no_invoice">No, I do not want an invoice</label>

My goal is to conditionally send the invoice email based on the customer’s selection. Specifically, if a customer selects “No, I do not want an invoice” (no_invoice), I would like to prevent the invoice email from being sent with their order confirmation.

I am seeking guidance on how to best implement this functionality within the context of your plugin. Is there a filter or action hook that I can utilize to achieve this conditional email sending? Or perhaps there is another recommended approach to handle this scenario?

  • This topic was modified 3 hours, 13 minutes ago by popedcorn.


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer