PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 1.6.6 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 All 50 releases
← All changes | app/Services/Coupon/Concerns/CanCalculateLineTotal.php +10 -2 1.3.21 → 1.7.0 View file →
@@ -33,8 +33,13 @@
33 33 $this->previouslyAppliedCoupons->put($coupon->code, $coupon);
34 34 }
35 35
36 36 $this->formatDiscountNumbers();
37 +
38 + foreach ($lineItems as $id => $lineItem) {
39 + $lineItems[$id]['coupon_discount'] = (int) $lineItem['discount_total'];
40 + }
41 +
37 42 $this->calculatedLineItems = $lineItems;
38 43
39 44 }
40 45
@@ -154,10 +159,13 @@
154 159 'hash' => App::request()->get(Helper::INSTANT_CHECKOUT_URL_PARAM)
155 160 ]);
156 161
157 162 if ($cart) {
158 - $upgradeDiscount = Arr::get($cart, 'checkout_data.manual_discount.amount', 0);
159 - $totalPrice = $totalPrice - $upgradeDiscount;
163 + // Prorate credit is a post-tax adjustment to the payable total, not a
164 + // discount, so it must NOT reduce the coupon-applicable base. Only a
165 + // real manual discount reduces the base here.
166 + $manualDiscount = Arr::get($cart, 'checkout_data.manual_discount.amount', 0);
167 + $totalPrice = $totalPrice - $manualDiscount;
160 168 if ($totalPrice < 0) {
161 169 $totalPrice = 0;
162 170 }
163 171 }