php - 在 WooCommerce 电子邮件中的客户详细信息之后移动 BACS 银行详细信息
问题描述
我如何在 Woocommerce 邮件模板“customer-processing-order.php”中移动 BACS 银行详细信息。
我想从中删除/移动它
do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
而它之后
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
但是只有银行详细信息而不是 order_details 操作中的其他内容?
解决方案
无法针对特定的电子邮件通知...现在要在客户详细信息之后从 Woocommerce 电子邮件通知中移动 BACS 银行详细信息,请使用以下命令:
add_action( 'init', 'move_bacs_bank_details', 1000 );
function move_bacs_bank_details() {
if ( class_exists( 'WC_Payment_Gateways' ) ) {
$gateways = WC_Payment_Gateways::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 );
add_action( 'woocommerce_email_customer_details', array( $available_gateways['bacs'], 'email_instructions' ), 30, 3 );
}
}
}
代码位于活动子主题(或活动主题)的 functions.php 文件中。测试和工作。
推荐阅读
- javascript - function ==>function_name(a) vs function_name(a)(params) 有什么区别
- typescript - 添加新行后,Ag 网格未刷新。我正在使用角度 9
- php - 根据日期codeigniter计算访问总数
- autodesk-forge - 如何在 Autodesk forge 的 Model Derivative API 中找到 AutoCAD 文件的“闭包”数量?
- azure - 是否可以通过 Azure rest api 或 azure cli 在 Azure Api Management 中添加自定义域
- reactjs - 在本地环境中调试 React 生产构建代码的技巧
- python - 如何在python中正则表达式版本号?
- scalardb - ScalarDb 如何支持分页
- reactjs - 离开主页时,React-router V-5.2.0 无法正常工作
- android - 如果Expo React Native App中的文本长度超过2行,如何显示阅读更多按钮