Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.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 Woocommerce海关运费含税_Php_Wordpress_Woocommerce_Shipping - Fatal编程技术网

Php Woocommerce海关运费含税

Php Woocommerce海关运费含税,php,wordpress,woocommerce,shipping,Php,Wordpress,Woocommerce,Shipping,我有自定义的航运方法添加计算航运,并使用下面的代码 public function calculate_shipping( $package ) { $postcode_data = $package['destination']['postcode']; if(!empty($postcode_data)){ $weight = 0; $zone_data =

我有自定义的航运方法添加计算航运,并使用下面的代码

public function calculate_shipping( $package ) {
                $postcode_data = $package['destination']['postcode'];
                if(!empty($postcode_data)){
                $weight = 0;    
                $zone_data = checkzone($postcode_data);
                if(isset($package['destination']['postcode'])){
                if(!empty($zone_data)){     
                $weight = WC()->cart->cart_contents_weight;  // get cart total weight   
                if($weight <= 100){
                    $weight_range = ceil($weight / 10 );
                }
                elseif(($weight > 100 ) && ($weight < 150) ){
                    $weight_range = 11 ; 
                }
                if($weight >= 150) 
                {
                    $weight_range = 12 ; 
                }

                $pricing = getpricing($zone_data , $weight_range); 


                if($pricing > 0){                   
                $rate = array(
                    'id' => $this->id,
                    'label' => 'Delivery',
                    'cost' => $pricing,
                    'calc_tax' => 'per_order'
                );
                // Register the rate
                $this->add_rate( $rate );
                wc_clear_notices();
                }

                  } // if zone data

                    }
            }
            else { 
                $rate = array(
                    'id' => $this->id,
                    'label' => 'Delivery',
                    'cost' => 0,
                    'calc_tax' => 'per_order'
                );
                // Register the rate
                $this->add_rate( $rate );
                //wc_clear_notices();                   
                //wc_add_notice( 'Please enter zipcode to calculate the shipping', 'error' );       

                }   
                } // calculate shipping
public函数计算配送($package){
$postcode_data=$package['destination']['postcode'];
如果(!空($postcode_data)){
$weight=0;
$zone_data=checkzone($postcode_data);
如果(isset($package['destination']['postcode'])){
如果(!empty($zone_data)){
$weight=WC()->cart->cart\u contents\u weight;//获取购物车总重量
如果($weight 100)和($weight<150)){
$weight_范围=11;
}
如果($weight>=150)
{
$weight_range=12;
}
$pricing=getpricing($zone\u data,$weight\u range);
如果($pricing>0){
$rate=数组(
'id'=>this->id,
“标签”=>“交付”,
“成本”=>美元定价,
“计算税”=>“每订单”
);
//登记汇率
$this->add_rate($rate);
wc_清除通知();
}
}//如果区域数据
}
}
否则{
$rate=数组(
'id'=>this->id,
“标签”=>“交付”,
“成本”=>0,
“计算税”=>“每订单”
);
//登记汇率
$this->add_rate($rate);
//wc_清除通知();
//wc_添加_通知('请输入zipcode以计算装运','错误');
}   
}//计算运费
但在前端,它增加了不含税的税额。对于产品税是工作的罚款,但对于航运是独家价格,我想包括航运价格的税