如何从 WooCommerce 订单电子邮件中隐藏增值税标签和价值? [英] How to hide VAT label and value from WooCommerce order emails?

查看:51
本文介绍了如何从 WooCommerce 订单电子邮件中隐藏增值税标签和价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想隐藏或删除 WooCommerce 订单电子邮件中的增值税(税)行.结果来自这个函数get_order_item_totals()".我已经可以使用以下代码从电子邮件中隐藏税务标签.

I want to hide or remove VAT (tax) line from WooCommerce order emails. Result comes out from this function "get_order_item_totals()". Already I can hide tax label from emails by using following code.

function sv_change_email_tax_label( $label ) {
    $label = '';
    return $label;
}
add_filter( 'woocommerce_countries_tax_or_vat', 'sv_change_email_tax_label'       );

我想在订单电子邮件中隐藏整行增值税.

I want to hide the entire row of VAT from order emails.

推荐答案

终于想出了一个办法.get_order_item_totals()"函数返回一个数组数组.所以我 unset() 不需要的数组.在这种情况下 $totals[tax]以下是我在电子邮件模板中的代码.

Finally figured out a way do this. "get_order_item_totals()" function returns an Array of arrays. so i unset() the unwanted array. in this case $totals[tax] following is my code in email template.

<?php
    if ( $totals = $order->get_order_item_totals() ) {              
       unset($totals[tax]);
       $i = 0;
       foreach ( $totals as $total ) {                  
       $i++;                    
     ?><tr>
       <th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
       <td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
</tr><?php                  
      }
   }
 ?>

非常感谢所有试图提供帮助的人!问候!

Thank you very much everyone who tried to help! Regards!

这篇关于如何从 WooCommerce 订单电子邮件中隐藏增值税标签和价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆