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 关注
- 156 浏览
添加回答
举报