PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | app/Modules/Shipping/ShippingModule.php +11 -1 1.3.25 → 1.6.5 View file →
@@ -37,9 +37,10 @@
37 37
38 38 $ignores = [
39 39 'apply_coupons',
40 40 'discounts_recalculated',
41 - 'remove_coupon'
41 + 'remove_coupon',
42 + 'payment_method_fee_recalculate',
42 43 ];
43 44
44 45 if (in_array($scope, $ignores)) {
45 46 return;
@@ -88,8 +89,16 @@
88 89 {
89 90 $shippingCountry = Arr::get($fillData, 'checkout_data.form_data.shipping_country', null);
90 91 $shippingState = Arr::get($fillData, 'checkout_data.form_data.shipping_state', null);
91 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 +
92 101 $availableShippingMethods = AddressHelper::getShippingMethods($shippingCountry, $shippingState);
93 102
94 103 if (!$availableShippingMethods || is_wp_error($availableShippingMethods)) {
95 104 Arr::set($fillData, 'checkout_data.shipping_data.shipping_charge', 0);
@@ -99,8 +108,9 @@
99 108 foreach ($cartData as &$cartItem) {
100 109 $cartItem['shipping_charge'] = 0;
101 110 $cartItem['itemwise_shipping_charge'] = 0;
102 111 }
112 + unset($cartItem);
103 113
104 114 Arr::set($fillData, 'cart_data', $cartData);
105 115
106 116 return $fillData;