Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.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,我用PHP为WooCommerce支付了一笔全球附加费,因为我们所有的客户都必须为特快专递支付费用 有没有办法让费用忽略增值税 当我写15时,它会给数字加上增值税。我只想把我写的号码作为费用 TL:DR-MAKE附加费包括增值税 要使费用忽略增值税,您需要删除最后两个参数,因为它们与税收有关。第三个参数为false,默认情况下不征税: 还包括全球商业;和$woocommerce->cart,因为在这个钩住的函数中缺少$cart参数。因此,请尝试以下方法: // Packing fee add_a

我用PHP为WooCommerce支付了一笔全球附加费,因为我们所有的客户都必须为特快专递支付费用

有没有办法让费用忽略增值税

当我写15时,它会给数字加上增值税。我只想把我写的号码作为费用

TL:DR-MAKE附加费包括增值税


要使费用忽略增值税,您需要删除最后两个参数,因为它们与税收有关。第三个参数为false,默认情况下不征税:

还包括全球商业;和$woocommerce->cart,因为在这个钩住的函数中缺少$cart参数。因此,请尝试以下方法:

// Packing fee
add_action( 'woocommerce_cart_calculate_fees','wc_add_surcharge' ); 
function wc_add_surcharge( $cart ) { 
    if ( is_admin() && ! defined( 'DOING_AJAX' ) ) 
        return;

    $county = array('DK');
    // change the $fee to set the surcharge to a value to suit
    $fee = 15;

    if ( in_array( WC()->customer->get_shipping_country(), $county ) ) : 
        $cart->add_fee( 'Emballage pant', $fee );  
    endif;
}

代码进入活动子主题或活动主题的function.php文件。测试和工作。

谢谢你,Loic。真是太棒了!是否有可能使其与商业税计数一起工作?所以它说包括XX增值税?@eMikkelsen没有增值税,因为费用设置为不征税……所以不包括增值税。
// Packing fee
add_action( 'woocommerce_cart_calculate_fees','wc_add_surcharge' ); 
function wc_add_surcharge( $cart ) { 
    if ( is_admin() && ! defined( 'DOING_AJAX' ) ) 
        return;

    $county = array('DK');
    // change the $fee to set the surcharge to a value to suit
    $fee = 15;

    if ( in_array( WC()->customer->get_shipping_country(), $county ) ) : 
        $cart->add_fee( 'Emballage pant', $fee );  
    endif;
}