Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php “显示”;不包括增值税“;商业产品小计_Php_Wordpress_Woocommerce - Fatal编程技术网

Php “显示”;不包括增值税“;商业产品小计

Php “显示”;不包括增值税“;商业产品小计,php,wordpress,woocommerce,Php,Wordpress,Woocommerce,在Woocommerce中,当您选择在结帐时显示价格(含增值税)时,Woocommerce会在td.产品小计之后添加一个.tax\u标签,并在总计之后添加一个.include\u tax。对于来自增值税为0%的国家/地区的客户,不显示任何内容,我需要税务标签,包括要显示为“不含增值税”的税务。因此,在td.product-subtotal单元格中,应存在添加了“不含增值税”的小计价格,在order-total.td中,应存在添加了“不含增值税”的总价 上面的过滤器不符合我的要求,因为它没有将“e

在Woocommerce中,当您选择在结帐时显示价格(含增值税)时,Woocommerce会在
td.产品小计
之后添加一个
.tax\u标签
,并在总计之后添加一个
.include\u tax
。对于来自增值税为0%的国家/地区的客户,不显示任何内容,我需要税务标签,包括要显示为“不含增值税”的税务。因此,在td.product-subtotal单元格中,应存在添加了“不含增值税”的小计价格,在order-total.td中,应存在添加了“不含增值税”的总价


上面的过滤器不符合我的要求,因为它没有将“excl.VAT”添加到td.product小计中。

如果您谈论的是购物车小计,则有一个过滤器用于该购物车小计

<?php
add_filter( 'woocommerce_cart_subtotal', 'filter_woocommerce_cart_subtotal', 10, 3 );
function filter_woocommerce_cart_subtotal( $cart_subtotal, $compound, $instance ) {
  if( ! empty( $cart_subtotal ) ) {
    return $cart_subtotal . ' - excl. VAT';
  };
}; ?>


未经测试,但应能正常工作。

@amainediary即使在税收不为0%的国家也会显示它……但我实际使用了它($cart->get_subtotal_tax()==0)。现在我仍然需要在total单元格的顺序中显示它。你知道有没有过滤器吗?
<?php
add_filter( 'woocommerce_cart_subtotal', 'filter_woocommerce_cart_subtotal', 10, 3 );
function filter_woocommerce_cart_subtotal( $cart_subtotal, $compound, $instance ) {
  if( ! empty( $cart_subtotal ) ) {
    return $cart_subtotal . ' - excl. VAT';
  };
}; ?>