-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Can't delete last item in cart if Minimum Order is Enable #6151 #9714
Conversation
…ng, editing or deleting products from quote
@@ -117,10 +117,6 @@ public function assign($cartId, \Magento\Quote\Api\Data\AddressInterface $addres | |||
$address->setSaveInAddressBook($saveInAddressBook); | |||
$address->setCollectShippingRates(true); | |||
|
|||
if (!$quote->validateMinimumAmount($quote->getIsMultiShipping())) { |
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 only other check for Minimum Amount occurs in the Checkout Index controller and it is not sufficient, since checkout flow may be performed using Web API without calling the controller.
Please consider moving this check to Place Order call.
… in QuoteManagement
@@ -179,7 +186,8 @@ public function __construct( | |||
\Magento\Checkout\Model\Session $checkoutSession, | |||
\Magento\Customer\Model\Session $customerSession, | |||
\Magento\Customer\Api\AccountManagementInterface $accountManagement, | |||
\Magento\Quote\Model\QuoteFactory $quoteFactory | |||
\Magento\Quote\Model\QuoteFactory $quoteFactory, | |||
\Magento\Quote\Model\Quote\Validator\MinimumOrderAmount\ValidationMessage $minimumAmountErrorMessage |
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.
Due to backwards compatibility policy we can not introduce a new required constructor argument as it may break any code which extends from this class.
Please change this argument to be optional and use ObjectManager to get the dependency, it will be refactored later when such changes are allowed.
Example:
public function __construct(
\Magento\Quote\Model\OldDependency $old,
\Magento\Quote\Model\NewDependency $new = null
) {
$this->old = $old;
$this->new = $new ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Quote\Model\NewDependency::class);
}
@@ -122,6 +122,11 @@ class QuoteManagementTest extends \PHPUnit_Framework_TestCase | |||
protected $quoteMock; | |||
|
|||
/** | |||
* @var \Magento\Quote\Model\Quote\Validator\MinimumOrderAmount\ValidationMessage | |||
*/ | |||
protected $minimumAmountErrorMessage; |
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.
We do not encourage inheritance based API's even in unit tests.
Please change this to private
.
This could potentially fix #8601 |
…d and long var names from codacy/pr
@ishakhsuvarov: addressed your comments, maybe you can have a look at it again |
[EngCom] Public Pull Requests - MAGETWO-69379 use payment method name to make checkbox of agreements more unique #6207 #9717 - MAGETWO-69378 #4272: v2.0.4 Credit memos with adjustment fees cannot be fully refunded with a second credit memo #9715 - MAGETWO-69375 Can't delete last item in cart if Minimum Order is Enable #6151 #9714 - MAGETWO-69230 #7279 bill-to name and ship-to name truncated to 20 chars #9654 - MAGETWO-69155 Fix coding standard in Magento AdminNotification module #9627
@storbahn thank you for your contribution to Magento 2 project |
@storbahn This issue still valid for Magento 2.1. Would you be interested in backporting of this solution to |
Description
During editing the cart (adding or removing products from cart) the minimum order amount (mam) will be checked. This caused that the last product could not be removed from cart. In this fix the validation of the mam is removed during editing the cart. The mam will checked later during checkout.
Fixed Issues (if relevant)
Manual testing scenarios
See steps to reproduce #6151: