I want to create a rule that gives people a discount of 10% if the subtotal of the cart is over $100.
I have this rule working but with one problem, to check weather the cart is over $100 it is using the subtotal without tax were I want it to use the subtotal with tax.
The condition I am using is pictured below.
I have looked into changing Configuration -> Sales -> Tax settings but most of these settings are already set how I need them for the rest of the site. There are also some products with and without tax so I cannot try and cheat my way by using a lower number.
Best Answer
Same issue with magento 2.2.2.
When you create a cart rule and you select Subtotal as cart attribute condition you are choosing the html option value
value="Magento\SalesRule\Model\Rule\Condition\Address|base_subtotal"
.It means that the cart rule will use the
quote_address.base_subtotal
column to validate the coupon's condition.If your catalog has the Catalog Prices option (Stores->Configuration->Sales->Tax->Calculation Settings) setted to Excluding Tax the
quote_address.base_subtotal
will contain subtotal WITHOUT tax.Now, digging in the magento core i found that the cart rule condition is validated in
vendor/magento/module-rule/Model/Condition/AbstractCondition.php
withvalidate()
method.To fix the issue, i changed the code in
so,
quote_address.base_subtotal_total_incl_tax
will be used instead ofquote_address.base_subtotal
.PS1: i also tried a lot on the web to find a solution and i did not find anything
PS2: i changed and suggested how to fix the issue directly in the core file, but it is a bad pratice, take your precautions :)