는 테마의 functions.php이 붙여 넣습니다 ...이 시도하고 아래 $products_to_look = array(34);
에 ID를 교체합니다.
add_filter('woocommerce_package_rates', 'woocommerce_package_rates');
function woocommerce_package_rates($rates) {
if (! WC()->cart->is_empty()) {
$products_to_look = array(34); // ids of products separated by comma.
$found = false;
foreach (WC()->cart->get_cart() as $cart_item) {
if ($found = in_array($cart_item['product_id'], $products_to_look)) {
break;
}
}
}
if ($found) {
foreach($rates as $key => $rate) {
$rates[$key]->label = 'Free shipping'; // change label to Free shipping...
$rates[$key]->cost = 0; // cost is set to 0.
}
}
return $rates;
}
또한 읽기 : WooCommerce shipping fee that changes when condition is met