我需要在購物車重量超過150磅後,移除購物車上的UPS運輸方式和結賬頁面。這是沿着我在想什麼...以編程方式刪除特定的送貨方式 - WooCommerce
function is_it_over_onefifty($available_methods){
global $woocommerce;
if ($woocommerce->cart->cart_contents_weight > 150){
//diable shipping
unset($available_methods['ups']);
}
else{
//do nothing
}
return $available_methods;
}
add_filter('woocommerce_available_shipping_methods', 'is_it_over_onefifty', 10, 1);
你是Google嗎?這是第一個結果:http://www.bolderelements.net/support/knowledgebase/hide-shipping-method-based-on-weight/ –
啊,哇,不能相信我錯過了。你會碰巧知道如何獲得運費ID?我目前正在尋找一種方法。 @cale_b –