
It manifests as well if you have configurable product, where associated product has 1 stock, and configurable has custom option. Once selected and added to cart. If you try to update only custom option, the result is the same.
It appears that the code in Magento/Quote/Model/Quote.php#updateItem updates product item or adds new one if product item with matching custom/configurable options does not exist and later removes old item.
Problem is inside updateItem(), call to to addProduct() throws, because actual product qty is 1.
Hi @ikrestov. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento-engcom-team give me $VERSION instance
where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.
@ikrestov do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
@magento-engcom-team give me 2.2.5 instance
Hi @ikrestov. Thank you for your request. I'm working on Magento 2.2.5 instance for you
Hi @ikrestov, here is your Magento instance.
Admin access: http://ec2-34-228-235-121.compute-1.amazonaws.com/i-18812-2-2-5//admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
@magento-engcom-team
Reproduced.



@magento-engcom-team give me 2.2.5 instance
Hi @ayazwebkul. Thank you for your request. I'm working on Magento 2.2.5 instance for you
Hi @ayazwebkul, here is your Magento instance.
Admin access: http://ec2-34-228-235-121.compute-1.amazonaws.com/i-18812-2-2-5//admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
@magento-engcom-team give me 2.2.6 instance
Hi @ayazwebkul. Thank you for your request. I'm working on Magento 2.2.6 instance for you
Hi @ayazwebkul, here is your Magento instance.
Admin access: http://ec2-34-228-235-121.compute-1.amazonaws.com/i-18812-2-2-6//admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
Adding more to the issue reproduction:
The issue can be generated if the product stock quantity is equal to the quantity in cart and then we try to update the cart options, we are getting the error message as We don't have as many "test product" as you requested.
Also, this is not related to qty 1 in stock, it can be reproduced with 50 qty in stock and then adding 50 qty in cart and then editing custom options.
It gives error until the qty is equal to at least double the qty in cart.
@ayazwebkul Thank you for verifying the issue.
Unfortunately, not enough information was provided to created internal ticket. Please consider adding the following:
"Component: " label(s) to this ticket based on verification result. If uncertain, you may follow the best guess"Reproduced on " label(s) to this ticket based on verification resultOnce all required information is added, please add label "Issue: Confirmed" again.
Thanks!
@ayazwebkul Thank you for verifying the issue.
Unfortunately, not enough information was provided to created internal ticket. Please consider adding the following:
"Component: " label(s) to this ticket based on verification result. If uncertain, you may follow the best guessOnce all required information is added, please add label "Issue: Confirmed" again.
Thanks!
@ayazwebkul Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-95948 were created
Hi @ketan-krish. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.[ ] 2. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. Verify that the issue is reproducible on 2.2-develop branch. Details
- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x
[ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.
Hi @engcom-backlog-andrii. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.[ ] 2. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. Verify that the issue is reproducible on 2.2-develop branch. Details
- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x
[ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.
@magento-engcom-team give me 2.3.0 instance
Hi @engcom-backlog-andrii. Thank you for your request. I'm working on Magento 2.3.0 instance for you
Hi @engcom-backlog-andrii, here is your Magento instance.
Admin access: https://i-18812-2-3-0.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
Refresh
Hi @shikhamis11. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.[ ] 2. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. Verify that the issue is reproducible on 2.2-develop branch. Details
- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x
[ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.
Hi @engcom-Bravo. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.[ ] 2. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.
@magento I am working on this issue
Hi @shikhamis11. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.[ ] 2. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.
is this issue resolved #18812 ? Please let me know the commit or code
Hello,
Did anybody found a solution for this problem ? Thanks
I have updated the magento version to 2.2.9 and it's working fine, maybe you need to update your magento version
@ankursharma1930 thanks for your answer!
In fact I'm already on 2.3.0 and I was forced to migrate from 2.2.5 because of an other feature which was broken and the fix never came out.
That's why I'm looking for a real fix to apply, I don't want to make an other migration as I'm not sure if it's fixed on more recent releases...
I think I'll have to take a look to the differences between 2.2.9 and 2.3.0 and see if I find something....
This is still an issue in 2.3.4
This is still an issue in 2.3.4
yes me also facing
mine :
configure product update also issue ...
i fixed with those plugins
Magento 2.3.4 (tested)
i knew this is not right way but for now it will work (We will check when new version released)
your custom module
Custom/Module/etc/frontend/di.xml
```
<!-- this plugin fix_if_stock_is_one_error_qty_is_not_available -->
<type name="Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\QuoteItemQtyList">
<plugin name="fix_if_stock_is_one_error_qty_is_not_available_quote_item" type="Custom\Module\Plugin\Quote\Item\QuantityValidator\QuoteItemQtyList" disabled="false" sortOrder="10"/>
</type>
Custom\Module\Plugin\Quote\ExtendedItem.php
namespace CustomModulePluginQuote;
use MagentoQuoteModelQuoteItem;
class ExtendedItem
{
/**
* @param Item $subject
* @param $result
* @param $qty
* @return mixed
*/
public function afterAddQty(Item $subject,$result,$qty){
if($subject->getQty()!=$qty)
{
$result->setQty($qty);
}
return $result;
}
}
Custom\Module\Plugin\Quote\Item\QuantityValidator\QuoteItemQtyList.php
namespace CustomModulePluginQuoteItemQuantityValidator;
use MagentoCatalogInventoryModelQuoteItemQuantityValidatorQuoteItemQtyList as CoreQuoteItemQtyList;
class QuoteItemQtyList
{
/**
* @param CoreQuoteItemQtyList $subject
* @param $productId
* @param $quoteItemId
* @param $quoteId
* @param $itemQty
* @return array
*/
public function beforeGetQty(CoreQuoteItemQtyList $subject,$productId, $quoteItemId, $quoteId, $itemQty)
{
/** we are using 0 because original qty was processed */
if($itemQty!=0){
$itemQty=0;
}
return [$productId, $quoteItemId, $quoteId, $itemQty];
}
}
```
This issue still there in 2.3.5-p1.
Any patches or fixes for this?
i fixed with those plugins
Magento 2.3.4 (tested)
i knew this is not right way but for now it will work (We will check when new version released)
your custom module
Custom/Module/etc/frontend/di.xml
<!-- this plugin fix_if_stock_is_one_error_qty_is_not_available custom options --> <type name="Magento\Quote\Model\Quote\Item"> <plugin name="fix_if_stock_is_one_error_qty_is_not_available" type="Custom\Module\Plugin\Quote\ExtendedItem" disabled="false" sortOrder="10"/> </type> <!-- this plugin fix_if_stock_is_one_error_qty_is_not_available --> <type name="Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\QuoteItemQtyList"> <plugin name="fix_if_stock_is_one_error_qty_is_not_available_quote_item" type="Custom\Module\Plugin\Quote\Item\QuantityValidator\QuoteItemQtyList" disabled="false" sortOrder="10"/> </type>CustomModulePluginQuoteExtendedItem.php
<?php namespace Custom\Module\Plugin\Quote; use Magento\Quote\Model\Quote\Item; class ExtendedItem { /** * @param Item $subject * @param $result * @param $qty * @return mixed */ public function afterAddQty(Item $subject,$result,$qty){ if($subject->getQty()!=$qty) { $result->setQty($qty); } return $result; } }CustomModulePluginQuoteItemQuantityValidatorQuoteItemQtyList.php
<?php namespace Custom\Module\Plugin\Quote\Item\QuantityValidator; use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\QuoteItemQtyList as CoreQuoteItemQtyList; class QuoteItemQtyList { /** * @param CoreQuoteItemQtyList $subject * @param $productId * @param $quoteItemId * @param $quoteId * @param $itemQty * @return array */ public function beforeGetQty(CoreQuoteItemQtyList $subject,$productId, $quoteItemId, $quoteId, $itemQty) { /** we are using 0 because original qty was processed */ if($itemQty!=0){ $itemQty=0; } return [$productId, $quoteItemId, $quoteId, $itemQty]; } }
This one worked in 2.3.5-p1. Thanks @prabhakaran777
Most helpful comment
This is still an issue in 2.3.4