如何在function.php中覆盖总运输成本?
我在functions.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;} } . . 。 . 如果($重量
.
.
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所知,谢谢!!