【发布时间】:2014-11-19 06:07:51
【问题描述】:
文件 email-order-items.php 有以下代码行:
echo "\n" . sprintf( __( 'Cost: %s', 'woocommerce' ), $order->get_formatted_line_subtotal( $item ) );
以下操作挂钩已添加到我正在使用的插件(Woocommerce 复合产品)中:
add_action( 'woocommerce_order_formatted_line_subtotal', array( $this, 'wc_cp_order_item_subtotal' ), 10, 3 );
我想重写函数 wc_cp_order_item_subtotal 以更改显示项目小计的方式。我尝试将以下内容添加到我的子主题functions.php,但它没有做任何事情。
remove_action( 'woocommerce_order_formatted_line_subtotal', 'wc_cp_order_item_subtotal', 10);
add_action( 'woocommerce_order_formatted_line_subtotal', 'child_wc_cp_order_item_subtotal', 10, 3);
function child_wc_cp_add_order_item_meta( $order_item_id, $cart_item_values, $cart_item_key = '' ) {
return 'xxxxxxx';
}
任何帮助我完成这项工作的提示将不胜感激。
【问题讨论】:
标签: wordpress woocommerce