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> <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> </div> </div>
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?
