Customer Invoice Email not sending
This topic contains 8 replies, has 5 voices, and was last updated by Alison Teitel 5 years, 1 month ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: invoice email
-
AuthorPosts
-
November 12, 2019 at 6:14 pm #3741
I have the checkbox checked to send the customer invoice email out to let them know that they need to pay it (screenshot attached).
I also checked my SendGrid account and installed and activated this plugin: https://wordpress.org/plugins/wp-mail-logging/
The email does not go out nor does any record of it get logged in either place.
I am creating my invoices with wpinv_insert_invoice() and all other emails I send with wp_mail go out just fine.
When I add the field user_note, I do get the “Customer Note” email so I know the email sending mechanism works. It just isn’t sending the customer invoice.
Please let me know what other debugging I can do. Thanks.
November 12, 2019 at 9:09 pm #3743Please post your URL and WP admin details in a private reply and we will check your settings if you like.
ThanksNovember 13, 2019 at 3:24 am #3745Just tell me where to look in the UI. I can’t give out access. I will be happy to screenshot whatever you need to see or check settings and report them here.
November 13, 2019 at 1:41 pm #3746We can’t debug a site via screenshots. Please provide credentials in a private reply, or alternative you could setup a staging server for us to do our job.
Thanks
November 13, 2019 at 2:20 pm #3747There is proprietary code and personal information that I can’t give access out to a third party without us drawing up an NDA of some kind and I’m not even sure that is an option.
I included the screenshot of those settings and I can provide you screenshots to whatever else you need to see in the back end.
I’m sure you can accommodate us this way. It might take a little longer, but it might be the only option.
You should be able to supply a short list of debugging steps or things to check out. I’ll check them and get back to you.
Thanks again.
November 14, 2019 at 12:22 am #3748If you visit the invoice in the backend and click the button to “Resend Invoice”
1) Is that how you want to trigger sending the invoice email?
2) Does that work?November 14, 2019 at 2:46 am #3749The “Resend Invoice” button sent out the invoice, but I need it to send after a successful call to wpinv_insert_invoice().
The invoices are created just fine and appear in the user’s dashboard, but no email gets sent even though that checkbox is checked. As I said before, when the below call includes the “user_note”, a user note email gets sent out.
I’ll include my call here.
All these variables are present and accurate. I populate a lot of these fields with ACF.
$data = array( 'status' => 'wpi-pending', 'user_id' => $practice_userid, 'cart_details' => $invoice_items, 'user_info' => array( 'first_name' => get_field("practice_owner_first_name", $practice_id), 'last_name' => get_field("practice_owner_last_name", $practice_id), 'phone' => get_field("practice_owner_phone", $practice_id), 'address' => get_field("practice_billing_address_1", $practice_id) . ' ' . get_field("practice_billing_address_2", $practice_id), 'city' => get_field("practice_billing_city", $practice_id), 'country' => 'US', 'state' => get_field("practice_billing_state", $practice_id), 'zip' => get_field("practice_billing_postal_code", $practice_id), 'company' => get_the_title($practice_id), 'vat_number' => '', 'discount' => '' ), 'due_date' => '2019-11-20', 'private_note' => 'assignment_id=' . $assignment_id, ); $invoice = wpinv_insert_invoice( $data, true );
November 14, 2019 at 5:14 am #3750Hi,
The function wpinv_insert_invoice() will not send an invoice as we are using that function to create an invoice from add ons and GD. You have to do minor customization to send an invoice in the email using a hook “wpinv_insert_invoice” from this function. Add note function sends a note to the customer so it will trigger email. Try the following code and let us know if it helps:
add_action('wpinv_insert_invoice', 'wpinv_insert_invoice_cb', 10, 2); function wpinv_insert_invoice_cb($invoice_id, $invoice_data){ if ( ! empty( $invoice_id ) ) { wpinv_user_invoice_notification( $invoice_id ); } }
Regards,
PatrikNovember 14, 2019 at 4:24 pm #3761That worked very nicely. I didn’t need to use the callback, although I might use it later. Upon the creation of my invoice I used your wpinv_user_invoice_notification() function.
Passing it the newly created invoice ID was all I needed to do after a successful creation.
Maybe include that in your list of developer functions as you continue to publish your documentation.
Thanks again for your help!
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket