-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions and environment
- Magento version
2.4.3-p2
- Enable Tablerate shipping
Steps to reproduce
Backend
- Create a cart rule with following
- {{{}Conditions{}}}:
Subtotal (Excl. Tax)
is equals or greater than100
- {{{}Actions{}}}:
Free Shipping
=For matching items only
- Create another cart rule with coupon
XYZ
to give aFixed amount discount for whole cart
of10
Storefront
- Add items to the cart to make a subtotal of 105
- Apply the coupon
XYZ
to get 10$ OFF
Expected result
The shipping fee should not be 0 (i.e. FREE shipping cart rule should not be applied)
Actual result
The shipping fee is showing 0 (i.e. FREE shipping cart rule is applied)
Additional information
Quick n Dirty Solution
Step debugging showed that the value provided by the $address->getData('base*subtotal_with*discount')
is not correct:
!https://user-images.githubusercontent.com/1205071/213677260-afb0ac81-6fd1-450a-a945-3212f479f63c.png|width=509,height=152!
So ended up tweaking as below:
\Magento\OfflineShipping\Model\SalesRule\Calculator::processFreeShipping()
``{{
public function processFreeShipping(\Magento\Quote\Model\Quote\Item\AbstractItem $item)
{
$address = $item->getAddress();
$item->setFreeShipping(false);
foreach ($this->_getRules($address) as $rule) {
/* Quick Fix - Start /
$address->setBaseSubtotalWithDiscount($address->getBaseSubtotal() + $address->getBaseDiscountAmount());
/ Quick Fix - End */
/* @var $rule \Magento\SalesRule\Model\Rule */
if (!$this->validatorUtility->canProcessRule($rule, $address))
{ continue; }
}}``
Release note
No response
Triage and priority
- < ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ > Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status