Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.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
如何在function.php中覆盖总运输成本?_Php_Wordpress_Woocommerce - Fatal编程技术网

如何在function.php中覆盖总运输成本?

如何在function.php中覆盖总运输成本?,php,wordpress,woocommerce,Php,Wordpress,Woocommerce,我在functions.php中有一个计算总运输成本的函数 . . if($weight < 5){ if($land == "DE"){ $shipping_costs = 4.99;} if($land == "AT"){ $shipping_costs = 8.89;} if($land == "CH"){ $shipping_costs = 12.70;} } . . 。 . 如果($重量

我在functions.php中有一个计算总运输成本的函数

.
.
if($weight < 5){
   if($land == "DE"){ $shipping_costs = 4.99;}
   if($land == "AT"){ $shipping_costs = 8.89;}
   if($land == "CH"){ $shipping_costs = 12.70;}
}
.
.
。
.
如果($重量<5){
如果($land==“DE”){$shipping_costs=4.99;}
如果($land==“AT”){$shipping_costs=8.89;}
如果($land==“CH”){$shipping_costs=12.70;}
}
.
.

我如何用新的$shipping\u costs值覆盖购物车和结帐中的总运费?

您需要,使用hook
woocommerce\u package\u rates
如@LoicTheAztec所知,谢谢!!