I am working on Magento 2.2.5. I have one cart rule that gives free shipping if the subtotal is equal to or greater then $50.

It is working well, but if the user gets any discount from a coupon or any other discount then it is not working properly as subtotal is not considering discount amount.

If user purchases $55 products then he/she will get the free shipping in the checkout page. But when he uses the coupon that gives 10%($5.5) discount then the amount will be $49.5 then also the free shipping is applying.

So anyway to add this rule on subtotal including discounted amount?

Or do I need to change any code for cart rule?

I read many solutions from the stack and tried but with no luck.

Some of are of Magento 1 but I am using Magento 2.2.5

  • you can set the condition on subtotal if its not work try action on price in cart in cart rule – Hitesh Nov 28 '18 at 10:06
  • Currently the rule is on subtotal. if subtotal is equal or greater then $50 then free shipping will apply/ – David Coder Nov 28 '18 at 10:08
  • Ok so try with actions on price in cart in cart rule it will solve your issue – Hitesh Nov 28 '18 at 10:09
  • No it is not working by that way also. – David Coder Nov 28 '18 at 10:17
  • please check my answer – Hitesh Nov 28 '18 at 10:28
  1. First You need to disable free shipping and enable flat rate.
  2. After that, you need to set the catalog price rules for free shipping discount over an order of 50$ or greater(add appropriate condition there). the In above case, your cart price rule(coupon code) and catalog price rule will work parallel.

Hope this helps.

  • I am not using free shipping method of magento. I have created rule for free shipping. – David Coder Nov 28 '18 at 10:30
  • Flate rate method is already enable – David Coder Nov 28 '18 at 10:31
  • My free shipping rule is already set with subtotal greater then $50. I am not getting your 2nd rule. – David Coder Nov 28 '18 at 10:33
  • Ok got it your case, you have created two coupon code right? one is for free shipping and other one is normal coupon code – Hitesh Nov 28 '18 at 10:38
  • Yes I have created cart rule for free shipping. I am not using magento's free shipping method. I have many other coupon code rule that can be use in checkout page to get discount – David Coder Nov 28 '18 at 11:13

Don't know if your problem is still a thing, but i stumbled upon this a few month ago and found a solution for nearly the same issue, so maybe it helps someone. For me following this tutorial: https://magently.com/blog/magento-2-custom-sales-rule-condition/
and changing the validation function worked. As in the documentation of AbstractModel
you can call the getSubtotalWithDiscount() function within the model and validate for being greater than 50.

public function validate(\Magento\Framework\Model\AbstractModel $model)
    $price = 0;   
    $price = $model->getSubtotalWithDiscount();

    if($price > 50){
        return true;
        return false;

  • Where I need to update this code? – VIPIN A ROY Jan 7 '20 at 12:51
  • @VIPINAROY if you followed the tutorial, you can find the validate function in *YOUR CODE DIRECTORY*/CustomerRule/Model/Rule/Condition/Customer.php . This function returns true or false, so you can modify as you need it – Chris Jan 22 '20 at 11:23

Actually the option Subtotal (excl. Tax) seems to be with discount, when having a look at the dropdown I see this:

<option value="Magento\SalesRule\Model\Rule\Condition\Address|base_subtotal_with_discount">Subtotal (Excl. Tax)</option>

So the base_subtotal_with_discount really seems to mean, that functionality is there in the core, but well hidden by bad translation.


Actually this does not work :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.