magento2: Unable to update simple product custom option in cart when quantity is 1
Preconditions (*)
- Magento CE 2.2.5, Updated(9/19/2019) can be reproduced on 2.3
- Although reproduced in 2.2.2-2.2.4
- Backorders disabled, minimum order qty is 1.
- A simple product with at least one custom option, e.g. size - 1,2,3; price type fixed.
Steps to reproduce (*)
- Go to product page and select options and click add to cart. || Update 9/19/2019: The quantity of the product added must be more than a half of its Stock quantity! ||
- Go to cart and select “Edit/Update Item”
- Select different option from original and click update.
Expected result (*)
- Redirected back to cart
- Product custom option updated.
Actual result (*)
- Error message on product page.
|| Update 9/19/2019: (Those messages haven’t been observed at now. Only the one below still appears) ||
The requested qty is not available
Notes
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.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 46 (18 by maintainers)
Commits related to this issue
- Fixed-Unable to update simple product custom option in cart when quantity is 1 #18812 — committed to ketan-krish/magento2 by ketan-krish 6 years ago
- Fixed #18812 Unable to update simple product custom option in cart when quantity is 1 — committed to opencommerce/magento2 by deleted user 5 years ago
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
Custom\Module\Plugin\Quote\ExtendedItem.php
Custom\Module\Plugin\Quote\Item\QuantityValidator\QuoteItemQtyList.php
This is still an issue in 2.3.4
Hi, any update on this issue ?
This one worked in 2.3.5-p1. Thanks @prabhakaran777