Order Email Send on PayPal Cancellation
-
Hi,
if customers select payment via the included WooCommerce PayPal option, but cancel the order, order emails are send nevertheless to the admin and the customer. Also, while the status changes appropriately in the orders list, no email is sent to the admin about this event. This seems not to be the intended behavior, which should be to send an email about the cancellation to the admin and no order emails at all.
Any ideas?
Felix
-
I forgot: I’m using WooCommerce 3.7.0, WP 5.2.2 and PHP 7.2.21.
Also, order emails are sent if payments are pending.Hi @felixhelix,
I understand you have three email issues:
> 1. when an order cancels due to cancelling before checking out, an email is sent to admin and customer.
By default, only the admin should be receiving a cancellation order email, and only if the order had previously been set to on-hold or processing. If an order goes from pending > cancelled because the customer decided to not complete purchase, then no email should get sent out at all. Could you provide a screenshot of the example cancelled order email that gets sent to the customer, as well as the order notes for the order?
> 2. If order statuses are changed, the admin is not receiving the emails for those changes
Which statuses are you referring to? By default, admins would only get the New Order, Cancelled and Failed status emails. Are they not receiving those emails?
> 3. Order emails send out when order status is in pending.
Do you mean the New Order emails sends out as soon as a pending order is created (when user gets redirected to PayPal)? By default, this should not happen. No emails get sent when an order is in pending status.
So a few things to try to troubleshoot these issues is to make sure this is not a theme or plugin conflict with WooCommerce.
First, backing up your live site before any testing and updates is highly recommended. If you would prefer not to do testing on your live site, first make a back up of your site, then create a staging site using this plugin WP Staging. This creates a copy of your live site where you can make tests without affecting your live site.
Temporarily switch your theme to one of our default – Storefront or Twenty Nineteen, then deactivate all plugins except for one – WooCommerce. Try replicating the issues. If it shows correctly, then it’s a theme or plugin conflict. Reactivating each plugin one at a time, then see if the issue pops up again will tell us which plugin is conflicting.
Many thanks for your reply @yukikatayama!
I noticed later that my description was a little confusing but couldn’t edit the text any longer. So thanks for breaking the problems down ??However, I experience only point 2 and 3. The problems only apply to payment via paypal:
2) No email is going out to the admin if the payment is cancelled / failed – due to active cancellation of the paypal process or by a timeout.
3) There is an order email going out already when a the customer is redirected to the paypal site.I deactivated all plugins but woocommerce and used the Twenty Nineteen theme.
Now, there is no longer an email going out when paypal is selected and the customer proceeds to the paypal site (point 3). So this seems indeed to depend on one of the other plugins.
But the second problem still persists: there is no email going out to inform the admin that the paypal payment was cancelled (despite the status change in woocommerce from pending to cancelled reflects this).
There are emails going out if the administrator changes an order from “pending” to “cancelled” – so it is not an issue with the general email settings.Your’s
FelixNo email is going out to the admin if the payment is cancelled / failed – due to active cancellation of the paypal process or by a timeout…there is no email going out to inform the admin that the paypal payment was cancelled (despite the status change in woocommerce from pending to cancelled reflects this).
If I understand correctly you are hoping for an admin email regarding cancellations due to timeouts or when customers decide to cancel at this stage of the payment:
Link to image: https://cld.wthms.co/uDtEaMBy default, no email will get sent regarding cancellations or failed orders if the order status was previously
pending
. Those emails will only get sent if the order status was previouslyon-hold
orprocessing
.
Link to image: https://cld.wthms.co/wXFGFnThere are emails going out if the administrator changes an order from “pending” to “cancelled” – so it is not an issue with the general email settings.
Could you provide exact steps taken to replicate this, as it is not default behavior to have a cancelled email sent to admin if the status was manually changed from
pending
tocancelled
. Could you also provide screenshots of the full order notes?Many thanks for your kind reply,
it helped very much to sort things out!By default, no email will get sent regarding cancellations or failed orders if the order status was previously pending. Those emails will only get sent if the order status was previously on-hold or processing.
Then the behavior of the shop is as intended, because opposite to what I wrote earlier there is indeed no email going out if the status is manually changed from
pending
tocancelled
, but only if the status wason hold
orprocessing
.This solves this issue ??
However: Is it possible to get noticed if an order that was on
pending
is cancelled? As that could be a sign of some problems i.e. with the gateway.Your’s,
Felix- This reply was modified 5 years, 2 months ago by felixhelix.
Hi Felix,
Apologies for the late reply. There is the AutomateWoo plugin that will allow you to send emails and other actions based on a tigger you’ve created, such as when an order goes to
cancelled
. This plugin or similar may be what you’re looking for? https://automatewoo.com/Thanks very much again yukikatayama,
I think yes, the plugin seems to do the job and even more.
But isn’t there any hook in woocommerce that is called when an order status changes frompending
tocancelled
that I can use so that I can setup an email myself?
I would expect a message to the admin in case of failure is a standard feature of a shop software.
Your’s
FelixHi
I have a similar problem (WordPress 5.2.3 Woocommerce 3.7.0)
“if customers select payment via the included WooCommerce PayPal option, but cancel the order, order emails are send nevertheless to the admin and the customer”
@felixhelix did you find out which plugin caused the problem?
thanks woz
Hi,
we use a plugin called “germanized”. It seems like this is sending the mail prematurely.
Your’s
Felix@yukikatayama Hi again!
Our customer argues that mails have been sent on paypal cancellation events before (there exist mails from January and March 2018 sent because of paypal cancellation). Is it possible that this feature once was implemented in WooCommerce and later has been removed?
Regards,
Felix- This reply was modified 5 years, 1 month ago by felixhelix.
@felixhelix That timeframe is quite awhile ago, and without any logging to go off of it would be difficult to determine what may have happened. There may have been a bug, settings may have been different, it’s not possible to know exactly what the issue may have been.
Is the problem resolved now?
@jessepearson Unfortunately not. And I wonder that the issue is not handle by WooCommerce, since it should be of interest if a payment has been cancelled (for whatever reasons). Although, I mean it is signaled if you look at the orders, but i.m.h.o. there should be an option to send a mail to admin in this case.
Anyway: Thanks for your help so far ??
Regards,
Felix@felixhelix I read over everything in the thread again and it seems the main issue is that the Cancelled email is not sent once an order is moved from Pending to Cancelled.
I looked into seeing if this was something that was easily done via an action or filter, and it is not. The only thing I can see to do would be to use an additional plugin that sends emails on order changes or to duplicate the code that sends the cancelled email notice and add another action in there to send on the different status change.
@jessepearson Thanks for looking into this issue again. Yes, I can try to find the hook for the status change and attach code to it to send out a mail. For the moment our customer daily gets an csv file of all orders, with the cancelled orders having a different status. So he can look into this to find out if anything went wrong and contact the respective customers.
All the best,
Felix@felixhelix an @jessepearson I’ve had the same problem at a woocommerce shop which uses paypal-plus and the germanized plugin.
This is the solution I’ve found after digging a bit deeper into it.// Reactivated E-Mail notifications for cancelled pending orders - customer wants it! // Removed by woo in this commit as bugfix: https://github.com/woocommerce/woocommerce/pull/15170/files function cancelled_send_an_email_notification( $order_id, $order ){ // Getting all WC_emails objects $email_notifications = WC()->mailer()->get_emails(); // Sending the email $email_notifications['WC_Email_Cancelled_Order']->trigger( $order_id ); } add_action('woocommerce_order_status_pending_to_cancelled', 'cancelled_send_an_email_notification', 10, 2 );
It seems that at some point this specific mail trigger for the cancelled orders was removed,
so that it only sends emails if the order was in “processing” state before cancellation.
In the comment there is a link to the commit in the woocommerce repo where this trigger for “pending” orders was removed.Best regards,
Bernhard
- The topic ‘Order Email Send on PayPal Cancellation’ is closed to new replies.