Packeta sa nespráva ako be?ny shipping?
-
Zdravím Vás. Rie?im dilemu, ke? mám aj nadrozmerny tovar, ktory packeta nezoberie (presahuje rozmery). Takéto produkty ozna?ujem product tagom “Nadrozmerné” a v takom prípade chcem skry? mo?nosti doru?i? Packetou. Pou?ívam na to php snippet
add_filter('woocommerce_package_rates', 'shipping_based_on_country_subtotal_and_free_available', 100, 2); function shipping_based_on_country_subtotal_and_free_available($rates, $package) { //var_dump($rates); $free = array(); $condition = false; foreach (WC()->cart->get_cart() as $cart_item) { $product_id = $cart_item['product_id']; if (has_tag(30, $product_id)) { $condition = true; break; } } // Loop through shipping rates for current shipping package foreach ($rates as $rate_key => $rate) { if ($condition) { $targeted_rate_id = 'packetery_carrier_zpointcz'; if ($targeted_rate_id === $rate_key) { unset($rates[$targeted_rate_id]); } } } return $rates; }
Bohu?ia?, tento snippet nefunguje, dokonca mám pocit, ?e Packeta sa nespráva ako be?ná shipping method, ale ako nie?o iné. Vedeli by ste mi poradi?, ako túto vec viem dosiahnu??
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Packeta sa nespráva ako be?ny shipping?’ is closed to new replies.