-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Added option to exclude discount for minimum order amount calculation #19136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added option to exclude discount for minimum order amount calculation #19136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ccasciotti thanks for the contribution, please see my code review notes
@@ -2289,7 +2298,11 @@ public function validateMinimumAmount($multishipping = false) | |||
$baseTotal = 0; | |||
foreach ($addresses as $address) { | |||
$taxes = ($taxInclude) ? $address->getBaseTaxAmount() : 0; | |||
$baseTotal += $address->getBaseSubtotalWithDiscount() + $taxes; | |||
if ($includeDiscount) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation of getBaseSubtotalWithDiscount
method is as simple as $this->getBaseSubtotal() + $this->getBaseDiscountAmount()
. If there is no bugs related to tax in current implementation I would suggest simply returning $this->getBaseSubtotal() + $taxes
or $address->getBaseSubtotalWithDiscount() + $taxes
depending on includeDiscount
configuration value.
Please consider the same for other instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sivaschenko,
changes implemented
Hi @sivaschenko, thank you for the review. |
Hi @ccasciotti, thank you for your contribution! |
…um order amount calculation #19136
Hi @ccasciotti. Thank you for your contribution. |
Description
This PR adds option for store manager to include or exclude discount amount from minimum order amount calculation. Sometimes client wants to exclude discount amount from minimum order and want that only subtotal is used. The default option is set to "Yes" so Magento will use the current behavior.
Fixed Issues (if relevant)
none
Manual testing scenarios
Contribution checklist