答案 0 :(得分:0)
您可以使用操作挂钩 woocommerce_order_status_cancelled ,当订单状态更改为已取消时,将执行此操作。
例如:
Param(
$startdate = (read-host -Prompt "Enter date"),
$today = (Get-Date),
$RelPath = (read-host -Prompt "Enter filepath"),
$RelFiles = "FullName"
)
Get-ChildItem -Path $RelPath"*.pdf", "*.txt" -Recurse|
Where-Object { $_.LastWriteTime -gt $startdate -and $_.LastWriteTime -lt
$today}|select -Property $RelFiles |sort -Property $RelFiles |export-csv
C:\PowershellNewWork\New.csv
答案 1 :(得分:0)
以下是 woocommerce_email_recipient_cancelled_order
过滤器钩子中的自定义附加功能:
add_filter( 'woocommerce_email_recipient_cancelled_order', 'adding_customer_email_recipient_to_cancelled', 10, 2 );
function adding_customer_email_recipient_to_cancelled( $recipient, $order ){
if( is_admin() ) return $recipient;
$billing_email = $order->get_billing_email();
$recipient .= ', ' . $billing_email;
}
代码放在活动子主题(或主题)的function.php文件中,或者放在任何插件文件中。
此代码已经过测试,适用于WooCommerce 3.0 +