从 Woocommerce 电子邮件通知中删除 "Shipping" 标签
Remove "Shipping" label from Woocommerce Email notifications
我想从 woocommerce 订单确认电子邮件 table 中删除或隐藏 "shipping" 标签。
以下小代码片段将从电子邮件通知中仅删除标签 "Shipping":
add_filter( 'woocommerce_get_order_item_totals', 'customize_email_order_line_totals', 1000, 3 );
function customize_email_order_line_totals( $total_rows, $order, $tax_display ){
// Only on emails notifications
if( ! is_wc_endpoint_url() || ! is_admin() ) {
// Remove "Shipping" label text from totals rows
$total_rows['shipping']['label'] = '';
}
return $total_rows;
}
代码进入您的活动子主题(活动主题)的 function.php 文件。已测试并有效。
要从电子邮件通知中删除运费总计行,请改用以下内容:
add_filter( 'woocommerce_get_order_item_totals', 'customize_email_order_line_totals', 1000, 3 );
function customize_email_order_line_totals( $total_rows, $order, $tax_display ){
// Only on emails notifications
if( ! is_wc_endpoint_url() || ! is_admin() ) {
// Remove shipping line from totals rows
unset($total_rows['shipping']);
}
return $total_rows;
}
代码进入您的活动子主题(活动主题)的 function.php 文件。已测试并有效。
It's not possible to target a specific email notification.
我想从 woocommerce 订单确认电子邮件 table 中删除或隐藏 "shipping" 标签。
以下小代码片段将从电子邮件通知中仅删除标签 "Shipping":
add_filter( 'woocommerce_get_order_item_totals', 'customize_email_order_line_totals', 1000, 3 );
function customize_email_order_line_totals( $total_rows, $order, $tax_display ){
// Only on emails notifications
if( ! is_wc_endpoint_url() || ! is_admin() ) {
// Remove "Shipping" label text from totals rows
$total_rows['shipping']['label'] = '';
}
return $total_rows;
}
代码进入您的活动子主题(活动主题)的 function.php 文件。已测试并有效。
要从电子邮件通知中删除运费总计行,请改用以下内容:
add_filter( 'woocommerce_get_order_item_totals', 'customize_email_order_line_totals', 1000, 3 );
function customize_email_order_line_totals( $total_rows, $order, $tax_display ){
// Only on emails notifications
if( ! is_wc_endpoint_url() || ! is_admin() ) {
// Remove shipping line from totals rows
unset($total_rows['shipping']);
}
return $total_rows;
}
代码进入您的活动子主题(活动主题)的 function.php 文件。已测试并有效。
It's not possible to target a specific email notification.