2017-05-31 48 views
0

我正在尝试添加一个过滤器以吸引商务,该计算基于购物车数量计算税额,并且仅当物品运送至纽约时,订单> 110 $不付税,并且订单< 110运到纽约州的$ &应支付8,865%的税。 我发现这个代码的地方,但不知道如果作品,既不在哪里使用它。添加Woo商业税过滤器

add_filter('woocommerce_product_tax_class','big_apple_get_tax_class', 1, 2); 

function big_apple_get_tax_class($tax_class, $product) { 
if (WC()->cart->subtotal <= 110) 
    $tax_class = 'Zero Rate'; 

return $tax_class; 
} 

Apreciatte any help!

回答

0
 // Added the contion for Tax below/above the 110 
     $this->total = max(0, apply_filters('woocommerce_calculated_total', round($this->cart_contents_total + $this->fee_total, $this->dp), $this)); 

     if($this->total > 110){ 
      $this->total = max(0, apply_filters('woocommerce_calculated_total', round($this->cart_contents_total + $this->tax_total + $this->shipping_tax_total + $this->shipping_total + $this->fee_total, $this->dp), $this)); 
     }else{ 
      $this->taxes = 0; 
     } 

加在可湿性粉剂内容/插件/ woocommerce /包括/类-WC-cart.php