u/1nonconformist

Customer emails are re-sent when restoring orders from the trash

I've just discovered this baffling behaviour, yet nobody seems to be talking about it

If you delete an order (or multiple orders) to the trash, and then restore them, the customer order email notifications are sent to the customers again.

After doing some testing, this only appears to happen if you have the High-performance order storage option enabled. If you have the WordPress posts storage (legacy) option enabled instead, the customer order emails are not re-sent.

I discovered this by chance while debugging a plugin I'm working on, where I trashed about a hundred orders on the staging site and then restored them, and within minutes I was getting emails from customers wondering why they received their order notifications again (some of them from orders that were years old).

To confirm I wasn't going crazy and that maybe this was just an issue with my site, I spun up a fresh instance of WordPress on a new domain, activated WooCommerce only (no other plugins), created some fake orders, and was able to replicate the exact same behaviour with the High-performance order storage option enabled. When switching to the WordPress posts storage (legacy) option, the problem went away.

To me this is completely nonsensical.

Why is there different behaviour based on which storage option you use? And why would anyone want that behaviour anyway? It's not unheard of to accidentally delete an order and then restore it.

Is this known by everyone but never talked about? Or maybe an undiscovered bug?

reddit.com
u/1nonconformist — 6 days ago