1 回答
TA貢獻1877條經驗 獲得超1個贊
您的代碼有點過時(或舊)并且您錯過了鉤子函數參數,這將允許您定位“客戶完成的訂單”電子郵件通知。請嘗試以下操作:
add_action( 'woocommerce_email_before_order_table', 'action_email_before_order_table_callback', 9, 4 );
function action_email_before_order_table_callback( $order, $sent_to_admin, $plain_text, $email ){
$payment_method = $order->get_payment_method();
// Targeting "COD" payment method on Customer completed order email notification
if ( 'customer_completed_order' === $email->id && 'cod' === $payment_method ) {
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
remove_action( 'woocommerce_email_before_order_table', [ $available_gateways[$payment_method], 'email_instructions' ], 10 );
}
}
代碼位于活動子主題(或活動主題)的 functions.php 文件中。測試和工作。
- 1 回答
- 0 關注
- 200 瀏覽
添加回答
舉報
