axelra82
axelra82

Reputation: 537

Woocommerce processing email not auto sending

I've searched around and from what I can tell, most people just use an SMTP plugin for this... however, I want to know what's wrong! :)

A couple of weeks ago we started getting reports of customers not receiving their confirmation email when they placed an order with our store. This has worked fine before. And here is the really strange part, from what I can tell, it's just when an order i placed that the processing email isn't sent. We have two payment options, paypal and klarna. Both work, I've tried them myself. I placed real order for myself and everything worked fine... except the confirmation email from woocommerce. I can send it manually by re-sending processing email once I'm in the order... i.e. there is no problem with the send mail function!

I've also made sure I have all the latest confirmation mail template files in place.

This is a complete mystery to me. Any help in debugging would be great!

I'm on:

Wordpress 4.8

Woocommerce 3.1.1 (no errors in System status)

and PHP version: 7.0.21

I've checked my PHP log and I do get some fatal error messages each day (these are recurrent):

[02-Aug-2017 05:42:19 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /[root]/wp-content/plugins/woocommerce/includes/wc-conditional-functions.php on line 22

[02-Aug-2017 05:44:08 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /[root]/wp-includes/cache.php on line 548

[02-Aug-2017 05:46:07 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /[root]/wp-includes/class-wp-hook.php on line 291

[02-Aug-2017 06:51:12 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /[root]/wp-content/plugins/woocommerce/includes/wc-page-functions.php on line 59

[02-Aug-2017 08:42:21 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /[root]/wp-includes/cache.php on line 548 [02-Aug-2017 12:28:56 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /[root]/wp-includes/cache.php on line 123

[02-Aug-2017 12:29:48 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /[root]/wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php on line 86

PS. I've installed WP Mail log, and it's logging just fine. However, new orders don't have any mail sent, at all, so there's nothing there either :(

EDIT

I tried an SMTP plugin but of course this doesn't solve the issue. Since the emails aren't being sent... i.e. when a customer finishes payment for an order and it is marked as processing, no email is sent. So this is not a SMTP solvable error.

Upvotes: 0

Views: 884

Answers (2)

Chris
Chris

Reputation: 51

I had a similar problem just now and my issue was that we had an outdated template file for payment-processing.php.

Upvotes: 0

axelra82
axelra82

Reputation: 537

Just wanted to note that this issue has been resolved. The problem was a function in our functions.php More specifically this one:

/*
* Show prices with zero decimals on the catalogue and product pages.
* @param int decimals The number of decimals passed by WooCommerce.
* @return int The number of decimals used to show the price.
* @author Aelia
*/
function woocs_subzero($decimals) {
    if(!is_admin() || defined('DOING_AJAX')) {
        // Set zero decimals everywhere for all currencies except [BASE_CURRENCY], and on all pages except cart and checkout
        if( ( get_woocommerce_currency() !== 'SEK' ) && !is_cart() && !is_checkout() ) {
            return 0;
        }
    }
    return $decimals;
}add_filter('pre_option_woocommerce_price_num_decimals', 'woocs_subzero', 50, 2);

This was to force the Aelia currency converter plugin to display all prices without trailing zeros. This has worked before but I believe it was in conflict with another filter we had active //Trim zeros in price decimals add_filter( 'woocommerce_price_trim_zeros', '__return_true' );

So in conclusion, removing the the former function and only using the later filter works.

Upvotes: 1

Related Questions