Last active
January 17, 2026 00:09
-
-
Save jessepearson/6ce9d0da4ace57501876434f57fdde9a to your computer and use it in GitHub Desktop.
This will turn on deferred transactional emails in WooCommerce. This may help if you are experiencing slow checkouts or checkout timeouts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php // Do not copy this line | |
| /** | |
| * This will turn on deferred transactional emails in WooCommerce. This may help if you | |
| * are experiencing slow checkouts or checkout timeouts. | |
| */ | |
| add_filter( 'woocommerce_defer_transactional_emails', '__return_true' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is not based on WP Cron, it uses an async queue, this one: https://github.com/deliciousbrains/wp-background-processing
What it does is basically just before PHP would shut down, it fires a remote request to the site itself without waiting for the response. The request triggers another PHP process in which the queued actions are performed. So the emails deferred this way are sent almost instantly, but they are sent in a different request, independent of the actual one, therefore any issues or waiting for SMTP server, etc cannot slow down the response to the main request.