| @@ -89,8 +89,16 @@ | ||
| 89 | 89 | { |
| 90 | 90 | $shippingCountry = Arr::get($fillData, 'checkout_data.form_data.shipping_country', null); |
| 91 | 91 | $shippingState = Arr::get($fillData, 'checkout_data.form_data.shipping_state', null); |
| 92 | 92 | |
| 93 | + // Checkout renderer resolves shipping methods with a billing fallback when no | |
| 94 | + // shipping address is set (ship-to-different unchecked). Resolve the same way | |
| 95 | + // here, otherwise this chain zeroes the method/charges the renderer just offered. | |
| 96 | + if (!$shippingCountry) { | |
| 97 | + $shippingCountry = Arr::get($fillData, 'checkout_data.form_data.billing_country', null); | |
| 98 | + $shippingState = Arr::get($fillData, 'checkout_data.form_data.billing_state', null); | |
| 99 | + } | |
| 100 | + | |
| 93 | 101 | $availableShippingMethods = AddressHelper::getShippingMethods($shippingCountry, $shippingState); |
| 94 | 102 | |
| 95 | 103 | if (!$availableShippingMethods || is_wp_error($availableShippingMethods)) { |
| 96 | 104 | Arr::set($fillData, 'checkout_data.shipping_data.shipping_charge', 0); |
| @@ -100,8 +108,9 @@ | ||
| 100 | 108 | foreach ($cartData as &$cartItem) { |
| 101 | 109 | $cartItem['shipping_charge'] = 0; |
| 102 | 110 | $cartItem['itemwise_shipping_charge'] = 0; |
| 103 | 111 | } |
| 112 | + unset($cartItem); | |
| 104 | 113 | |
| 105 | 114 | Arr::set($fillData, 'cart_data', $cartData); |
| 106 | 115 | |
| 107 | 116 | return $fillData; |