问题
I have set up the stock in the woocommerce and configure the time for auto cancel the order after some minutes if payments are not done, it is working fine order is canceled after that period but not an email is generated. I have checked the email address and copy the template to my theme but not made any changes yet,
To receive the emails, how To fix this issue?
Note: New Order email is receiving but not this order canceled.
Here is the status of Woocomerce:
### WordPress Environment ###
Home URL: https://www.lfp-store.de
Site URL: https://www.lfp-store.de
WC Version: 3.2.5
Log Directory Writable: ✔
WP Version: 4.9.1
WP Multisite: -
WP Memory Limit: ❌40 MB - We recommend setting the PHP memory limit (memory_limit) to at least 64 MB. See: PHP increase memory limit
WP Debug Mode: -
WP Cron: ✔
Language: de_DE_formal
### Server Environment ###
Server Info: Apache
PHP Version: 06/05/32
PHP Post Max Size: 6 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.38.0
OpenSSL / 1.0.1t
SUHOSIN Installed: -
MySQL Version: ❌5.5.58 - We recommend at least MySQL version 5.6. See: WordPress Requirements
Max Upload Size: 64 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔
### Database ###
WC Database Version: 3.2.5
WC Database Prefix: hcQxuuYa
MaxMind GeoIP Database: ✔
Total database size: 8.75MB
Database data size: 6.55MB
Database index size: 2.20MB
hcQxuuYawoocommerce_sessions: Data: 0.05MB + Index: 0.00MB
hcQxuuYawoocommerce_api_keys: Data: 0.00MB + Index: 0.00MB
hcQxuuYawoocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.01MB
hcQxuuYawoocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.00MB
hcQxuuYawoocommerce_order_items: Data: 0.01MB + Index: 0.01MB
hcQxuuYawoocommerce_order_itemmeta: Data: 0.09MB + Index: 0.07MB
hcQxuuYawoocommerce_tax_rates: Data: 0.00MB + Index: 0.01MB
hcQxuuYawoocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB
hcQxuuYawoocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB
hcQxuuYawoocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.01MB
hcQxuuYawoocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB
hcQxuuYawoocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB
hcQxuuYawoocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.00MB
hcQxuuYawoocommerce_log: Data: 0.02MB + Index: 0.02MB
hcQxuuYacommentmeta: Data: 0.00MB + Index: 0.01MB
hcQxuuYacomments: Data: 0.03MB + Index: 0.02MB
hcQxuuYaduplicator_packages: Data: 0.02MB + Index: 0.02MB
hcQxuuYalayerslider: Data: 0.07MB + Index: 0.00MB
hcQxuuYalayerslider_revisions: Data: 0.02MB + Index: 0.00MB
hcQxuuYalinks: Data: 0.00MB + Index: 0.00MB
hcQxuuYaoptions: Data: 0.58MB + Index: 0.12MB
hcQxuuYapostmeta: Data: 2.82MB + Index: 1.50MB
hcQxuuYaposts: Data: 2.69MB + Index: 0.22MB
hcQxuuYatermmeta: Data: 0.01MB + Index: 0.02MB
hcQxuuYaterms: Data: 0.01MB + Index: 0.03MB
hcQxuuYaterm_relationships: Data: 0.03MB + Index: 0.06MB
hcQxuuYaterm_taxonomy: Data: 0.01MB + Index: 0.01MB
hcQxuuYausermeta: Data: 0.05MB + Index: 0.03MB
hcQxuuYausers: Data: 0.00MB + Index: 0.01MB
hcQxuuYayoast_seo_links: Data: 0.02MB + Index: 0.02MB
hcQxuuYayoast_seo_meta: Data: 0.02MB + Index: 0.00MB
### Post Type Counts ###
attachment: 300
avia_framework_post: 29
nav_menu_item: 46
page: 22
portfolio: 1
post: 1
product: 146
product_variation: 1023
revision: 441
shop_coupon: 61
shop_order: 87
### Security ###
Secure connection (HTTPS): ✔
Hide errors from visitors: ✔
### Active Plugins (8) ###
Loco Translate: by Tim Whitlock - 2.0.17
UpdraftPlus - Backup / Restore: by UpdraftPlus.Com
David Anderson - 1:13:16
Vendidero Helper: from Vendidero - 1.1.4
WooCommerce Germanized Pro: from Vendidero - 1.8.3
WooCommerce Germanized: from Vendidero - 1.9.6
Instant Banking for WooCommerce: by Sven Wagener - 1.3.0
WooCommerce: by Automattic - 3.2.5 - 3.2.6 is available
Yoast SEO: by Team Yoast - 5.9.3
### Settings ###
API Enabled: ✔
Force SSL: ✔
Currency: EUR (€)
Currency Position: right_space
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)
Taxonomies: Product Visibility: exclude-from-catalog
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated -2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)
### WC Pages ###
Shop-Basis: # 578 - / shop /
Warenkorb: # 507 - / cart-2 /
Kasse: # 28 - / checkout-2 /
Mein Konto: # 29 - / my-account /
Geschäftsbedingungen: # 693 - / general_agreement /
### Theme ###
Name: Enfold Child
Version: 1.0
Author URL: http://www.kriesi.at
Child Theme: ✔
Parent Theme Name: enfold
Parent Theme Version: 4.2
Parent Theme Author URL: https://kriesi.at
WooCommerce Support: ✔
### Templates ###
Overrides: enfold-child / woocommerce / emails / admin-canceled-order.php
enfold-child / woocommerce / emails / admin-new-order.php
enfold-child / woocommerce / emails / customer-on-hold-order.php
回答1:
To force "Cancelled" email-notification to be sent, you could try the following:
add_action('woocommerce_order_status_changed', 'cancelled_order_email_notifications', 10, 4 );
function cancelled_order_email_notifications( $order_id, $old_status, $new_status, $order ){
// Only when order status is changed to 'cancelled'
if ( $new_status != 'cancelled' ) return;
// Send cancelled email notification
WC()->mailer()->get_emails()['WC_Email_Cancelled_Order']->trigger( $order_id );
}
Code goes in function.php file of your active child theme (or active theme).
Tested and works.
Notes:
- This email notification is only sent to admin.
- Copying the related template file to your child theme will not help to send this notification.
来源:https://stackoverflow.com/questions/48181814/woocommerce-cancelled-email-notification-not-sent-when-order-expires