从 WooCommerce 的电子邮件通知中删除 BACS 指令
Removing BACS instructions from email notiications in WooCommerce
在我的 WooCommerce 网上商店中,我启用了付款通道 "Direct bank transfer"。
在Woocommerce
--> Settings
--> Checkout
--> BACS
中有一个字段叫做"instruction" 。此文本字段已添加到 thank you 页面,这很好。
但它也被添加到 costumer-order-completed 电子邮件,这是我不想要的。
我已经尝试了解负责电子邮件通知的 php 文件,但我不知道如何避免显示此 "instructions" 文本。
如何删除电子邮件通知中 BACS 支付网关的 "instructions" 文本?
你可以在第 38 行解决这个问题
do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
文件:https://github.com/woocommerce/woocommerce/blob/master/templates/emails/customer-completed-order.php
使用挂钩在 woocommerce_email_order_details
操作挂钩中的自定义函数将从电子邮件通知中删除 直接银行转帐 (BACS) 说明:
add_action( 'woocommerce_email_before_order_table', function(){
if ( ! class_exists( 'WC_Payment_Gateways' ) ) return;
$gateways = WC_Payment_Gateways::instance(); // gateway instance
$available_gateways = $gateways->get_available_payment_gateways();
if ( isset( $available_gateways['bacs'] ) )
remove_action( 'woocommerce_email_before_order_table', array( $available_gateways['bacs'], 'email_instructions' ), 10, 3 );
}, 1 );
代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件。
此代码已经过测试,适用于 WooCommerce 版本 2。6.x 和 3+
在我的 WooCommerce 网上商店中,我启用了付款通道 "Direct bank transfer"。
在Woocommerce
--> Settings
--> Checkout
--> BACS
中有一个字段叫做"instruction" 。此文本字段已添加到 thank you 页面,这很好。
但它也被添加到 costumer-order-completed 电子邮件,这是我不想要的。
我已经尝试了解负责电子邮件通知的 php 文件,但我不知道如何避免显示此 "instructions" 文本。
如何删除电子邮件通知中 BACS 支付网关的 "instructions" 文本?
你可以在第 38 行解决这个问题
do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
文件:https://github.com/woocommerce/woocommerce/blob/master/templates/emails/customer-completed-order.php
使用挂钩在 woocommerce_email_order_details
操作挂钩中的自定义函数将从电子邮件通知中删除 直接银行转帐 (BACS) 说明:
add_action( 'woocommerce_email_before_order_table', function(){
if ( ! class_exists( 'WC_Payment_Gateways' ) ) return;
$gateways = WC_Payment_Gateways::instance(); // gateway instance
$available_gateways = $gateways->get_available_payment_gateways();
if ( isset( $available_gateways['bacs'] ) )
remove_action( 'woocommerce_email_before_order_table', array( $available_gateways['bacs'], 'email_instructions' ), 10, 3 );
}, 1 );
代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件。
此代码已经过测试,适用于 WooCommerce 版本 2。6.x 和 3+