magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.5k stars 9.3k forks source link

Still shows Add to cart even if salable quantity is 0 #33819

Closed chequille closed 2 months ago

chequille commented 3 years ago

Preconditions (*)

  1. Magento 2.4.3

Steps to reproduce (*)

  1. Set "Display out of stock products" to Yes
  2. Place order with a product so salable qty is going to 0

Expected result (*)

  1. After placing order, add to cart should not be displayed anymore for product qith salable quantity 0

Actual result (*)

  1. Add to cart button is still shown

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 3 years ago

Hi @chequille. 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 give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

chequille commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

Hi @chequille. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @chequille, here is your Magento Instance: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering Admin access: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering/admin_cd65 Login: 768aabb2 Password: 531d94271192

m2-assistant[bot] commented 3 years ago

Hi @engcom-Echo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

chequille commented 3 years ago

Unbelievable, products where salable qty is 0 are still showing ADD TO CART button. I reproduced this in the Magento instance. Release notes of 2.4.3 says this is fixed, but it looks like it is not fixed.

What are you going to do on this?

engcom-Echo commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Echo. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Echo, here is your Magento Instance: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering Admin access: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering/admin_5f99 Login: c525c072 Password: 44559c1f41a1

engcom-Echo commented 3 years ago

Hi @chequille We tried to reproduce this issue on 2.4-develop & was unable to do so. Here are the Steps we followed,

  1. Stores > Configuration > Catalog > Inventory > Stock Options. Display Out of Stock Products: Choose Yes to enable displaying Magento out of stock products in the frontend
  2. Create / Edit a product such that its quantity is 1 & place an order for the product from frontend such that saleable quantity will become 0. Screenshot 2021-08-17 at 22 07 15 Screenshot 2021-08-17 at 22 08 29
  3. Once the order was placed , the product was displayed OUT OF STOCK on Search & Product Page.
Screenshot 2021-08-17 at 22 08 52

So kindly recheck this issue on Magento 2.4-develop branch and if the issue is still reproducible, please provide more details or additional/missing steps regarding the same. Thank you.

chequille commented 3 years ago

Made another try with "Impulse duffle" grafik Bought 100 pieces for product going to salable 0

grafik Going to the product page after order was placed. And Add to cart button is there as ou see: grafik Sorry, but I am not stupid and I did the same as you did. Do not understand why Add to Cart button is not there anymore on your try.

Maybe the only diffrence you made is, that you first changed the available qty to 1 and than you made the order for 1.

I will try this now as well.

chequille commented 3 years ago

Hi @engcom-Echo,

now I found the problem. As I mentioned before, you changed the inventory from 100 to 1 which I did not. I bought the 100 pieces. I tried now to first edit the prodcut and save it and than making an order for 100 pieces. When I do so, add to cart button is not shown anymore.

But this means, that the saving of a product does change something somewhere in the database. Of course, I did not do this on my site as I use a copy of my 2.3.x database (of course changing url for the site) and do a magento setup:upgrade which works so far as it should. If this is really the case as I described it I have to edit and save all products at least once.

I will try this now and will report my results.

Regards, Jürgen

chequille commented 3 years ago

Hi @engcom-Echo unfortunately, on my site even the editing and saving a product again does not change something. On my site add to cart is shown.

but something must be wrong in any case, Try not to change the product and place an order with the quantity which is in the database of a fresh magento instance (I think they are all set to 100) and you will see, that Add to cart is shown.

What else could it be? As I said already in Magento 2.3.x everything worked fine. Therefore, I do not think that some of my extensions causes this behaviour.

Does somebody have any idea? Regards Jürgen

engcom-Echo commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Echo. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Echo, here is your Magento Instance: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering Admin access: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering/admin_f080 Login: d28e080f Password: bc75551f981d

KM-HM commented 3 years ago

I have a magento 2.4.2 now updated to Magento 2.4.3 affected by the same issue.

Got a simple product with qty 1 salable qty 0 reservation for qty 1 form an order

Add to cart button still showing after reindex, cache.

All salabe check functions report the product is salable and in stock which is not correct. This happens in a production Magento instance where all order come in via checkout.

chequille commented 3 years ago

Oh, somebody else also has this problem. In some point of view I am very happy about this :-) I am not the only one.

In the meantime I disabled all third party modules which I am using in my setup, but still wrong!!!!

KM-HM commented 3 years ago

@chequille Did you do a data migration from m1 ?

This issue does not happen with all of the products for me.

chequille commented 3 years ago

@kemexyz No, I did not data migration. I am using database dump from my working 2.3.x installation and change of course the urls in core_config_data table and run magento setup:upgrade

This works pretty good, but maybe not regarding this issue. What I tried is to make a new product and did have a look with this new product. On my site, it still have the same behaviour.

So, no idea whats happening here.

In the meantime, I made my own block class which is using GetSalableQuantityDataBySku $getSalableQuantityDataBySku class to check if salable quantity is 0 or not. The only disadvantage doing this is, that I have to make my own block not cachable, because otherwise my function to get the value for salable qty is not the correct one. I do not see a real performance change, so if the guys here at magento will not find a solution, I will use it. Unfortunately, there is another problem with swatches of configurable products, which are not crossed if salable qty is 0. There is as well another ticket from my site regarding this. DId not find a solution for that yet on my own. Regards Jürgen

chequille commented 3 years ago

@kemexyz By the way, I remember now, that I did a data migration when I switch from M1 to M2 last year in June. Do you think this can be a problem?

KM-HM commented 3 years ago

@chequille I was thinking about it after testing a product that did not have the issue. But on a second test it was salable again even when salable qty was 0.

Just seems strange that we would be the only 2 people seeing this. I'm gonna try to test this on a clean M2.4.3 tonight.

chequille commented 3 years ago

@engcom-Echo Cannot belileve that you set this issue to "cannot reproduce" DID YOU READ WHAT I WROTE?

Once again: change Display Out of Stock Products to Yes and than place an order for a bag with qty 100 and have a look at this product. It is showing the Add to cart button as I said. Do not change anything else. Do not edit the product and change qty, just place the order with qty 100 and you will see the ADD TO CART BUTTON.

Maybe one hint why it is not working on my site: I found, that the database view inventory_stock_1 shows my products as salable even if in the backend under products salable qty is already 0 If I make the shipping for the orders and qty is going to 0, than inventory_stock_1 is going as well to 0

This seems the problem on my site and the question is why?

Please handle this issue as a serious one.

BR Chequille

engcom-Echo commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Echo. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Echo, here is your Magento Instance: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering Admin access: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering/admin_fec8 Login: 6ae82d9e Password: 4aa601937e35

engcom-Echo commented 3 years ago

Hi @chequille, First of all thank you for providing additional details for reproducing the issue, though we were unable to reproduce the issue at first instance with the steps you had provided, however with the new details we are able to reproduce the issue. But even with the new steps the issues doesnt seems to reiterate every item, I was able to reproduce the issue only for the first time on a clean magento instance, for every other trial the feature seemed to be working fine. Please refer the video for the steps taken to reproduce the issue.

https://user-images.githubusercontent.com/51681435/130015373-fe5f41c4-cc98-4d8f-be90-38ef5344b379.mp4

So we are confirming the issue & it will be worked upon. Thanks for reporting the issue.

github-jira-sync-bot commented 3 years ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 3 years ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 3 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-657 is successfully created for this GitHub issue.

m2-assistant[bot] commented 3 years ago

:white_check_mark: Confirmed by @engcom-Echo. Thank you for verifying the issue.
Issue Available: @engcom-Echo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

chequille commented 3 years ago

Hi @engcom-Echo

I saw your video but on my 2.4.3 installation it does not behave the same. ADD to Cart button only dissapears if I made the shippment. So here is my video and I guess, that something went wrong with updating the inventory_stock_1 view or the tables for this view. Video is a google drive link: https://drive.google.com/file/d/1WuwoxL4LD8rHjYyIK6wbPODntsE0cSSn/view?usp=sharing

chequille commented 3 years ago

Hi Guys, I do not know if this helps to find why on my site inventory stock still have the value 1 for the status, but I provide the traces and sql queries. Maybe somebody sees what is going wrong. The traces are from an order for roduct with ID 84 and 17 ieces were available before the order. The question is why it is still inserting 1 for stock_status?

2021-08-20 10:34:01

2807 ## QUERY

SQL: INSERT INTO cataloginventory_stock_status (product_id,website_id,stock_id,qty,stock_status) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE qty = VALUES(qty), stock_status = VALUES(stock_status) BIND: array ( 0 => 84, 1 => 0, 2 => 1, 3 => 17.0, 4 => 1, ) AFF: 1 TIME: 0.0024 TRACE: #1 Magento\Framework\DB\Logger\File[Magento\Framework\DB\Logger\LoggerAbstract]#0000000077619d6900000000148a1009#->getStats('query', 'INSERT INTO `ca...', array(84, 0, 1, 17, 1), &Magento\Framework\DB\Statement\Pdo\Mysql#000000007761929d00000000148a1009#) called at [vendor/magento/framework/DB/Logger/File.php:67]

2 Magento\Framework\DB\Logger\File#0000000077619d6900000000148a1009#->logStats('query', 'INSERT INTO `ca...', array(84, 0, 1, 17, 1), &Magento\Framework\DB\Statement\Pdo\Mysql#000000007761929d00000000148a1009#) called at [vendor/magento/framework/DB/Logger/LoggerProxy.php:152]

3 Magento\Framework\DB\Logger\LoggerProxy#0000000077619d0a00000000148a1009#->logStats('query', 'INSERT INTO `ca...', array(84, 0, 1, 17, 1), &Magento\Framework\DB\Statement\Pdo\Mysql#000000007761929d00000000148a1009#) called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:561]

4 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor[Magento\Framework\DB\Adapter\Pdo\Mysql]#0000000077619d7700000000148a1009#->_query('INSERT INTO `ca...', array(84, 0, 1, 17, 1)) called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:627]

5 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor[Magento\Framework\DB\Adapter\Pdo\Mysql]#0000000077619d7700000000148a1009#->query('INSERT INTO `ca...', array(84, 0, 1, 17, 1)) called at [generated/code/Magento/Framework/DB/Adapter/Pdo/Mysql/Interceptor.php:95]

6 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor#0000000077619d7700000000148a1009#->query('INSERT INTO `ca...', array(84, 0, 1, 17, 1)) called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:2031]

7 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor[Magento\Framework\DB\Adapter\Pdo\Mysql]#0000000077619d7700000000148a1009#->insertOnDuplicate('cataloginventory...', array(array('product_id' => 84, 'website_id' => 0, 'stock_id' => 1, 'qty' => 17, 'stock_status' => 1)), array('qty', 'stock_status')) called at [generated/code/Magento/Framework/DB/Adapter/Pdo/Mysql/Interceptor.php:374]

8 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor#0000000077619d7700000000148a1009#->insertOnDuplicate('cataloginventory...', array(array('product_id' => 84, 'website_id' => 0, 'stock_id' => 1, 'qty' => 17, 'stock_status' => 1)), array('qty', 'stock_status')) called at [vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php:352]

9 Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\DefaultStock#000000007761929b00000000148a1009#->_updateIndexTable(array(array('product_id' => 84, 'website_id' => 0, 'stock_id' => 1, 'qty' => 17, 'stock_status' => 1))) called at [vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php:318]

10 Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\DefaultStock#000000007761929b00000000148a1009#->_updateIndex(array(84)) called at [vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php:131]

11 Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\DefaultStock#000000007761929b00000000148a1009#->reindexEntity(array(84)) called at [vendor/magento/module-catalog-inventory/Model/Indexer/Stock/AbstractAction.php:276]

12 Magento\CatalogInventory\Model\Indexer\Stock\Action\Rows[Magento\CatalogInventory\Model\Indexer\Stock\AbstractAction]#000000007761928500000000148a1009#->doReindex(array(84)) called at [vendor/magento/module-catalog-inventory/Model/Indexer/Stock/AbstractAction.php:246]

13 Magento\CatalogInventory\Model\Indexer\Stock\Action\Rows[Magento\CatalogInventory\Model\Indexer\Stock\AbstractAction]#000000007761928500000000148a1009#->Magento\CatalogInventory\Model\Indexer\Stock{closure}() called at [vendor/magento/module-catalog-inventory/Model/Indexer/Stock/CacheCleaner.php:86]

14 Magento\CatalogInventory\Model\Indexer\Stock\CacheCleaner#000000007761929500000000148a1009#->clean(array(84), &Closure#000000007761928800000000148a1009#) called at [vendor/magento/module-catalog-inventory/Model/Indexer/Stock/AbstractAction.php:247]

15 Magento\CatalogInventory\Model\Indexer\Stock\Action\Rows[Magento\CatalogInventory\Model\Indexer\Stock\AbstractAction]#000000007761928500000000148a1009#->_reindexRows(array(84)) called at [vendor/magento/module-catalog-inventory/Model/Indexer/Stock/Action/Rows.php:30]

16 Magento\CatalogInventory\Model\Indexer\Stock\Action\Rows#000000007761928500000000148a1009#->execute(array(84)) called at [vendor/magento/module-catalog-inventory/Model/Indexer/Stock.php:85]

17 Magento\CatalogInventory\Model\Indexer\Stock\Interceptor[Magento\CatalogInventory\Model\Indexer\Stock]#000000007761928600000000148a1009#->executeList(array(84)) called at [vendor/magento/framework/Interception/Interceptor.php:58]

18 Magento\CatalogInventory\Model\Indexer\Stock\Interceptor#000000007761928600000000148a1009#->___callParent('executeList', array(array(84))) called at [vendor/magento/framework/Interception/Interceptor.php:138]

19 Magento\CatalogInventory\Model\Indexer\Stock\Interceptor#000000007761928600000000148a1009#->Magento\Framework\Interception{closure}(array(84)) called at [vendor/magento/framework/Interception/Interceptor.php:153]

20 Magento\CatalogInventory\Model\Indexer\Stock\Interceptor#000000007761928600000000148a1009#->___callPlugins('executeList', array(array(84)), array(array('cache_cleaner_af...'))) called at [generated/code/Magento/CatalogInventory/Model/Indexer/Stock/Interceptor.php:41]

21 Magento\CatalogInventory\Model\Indexer\Stock\Interceptor#000000007761928600000000148a1009#->executeList(array(84)) called at [vendor/magento/module-indexer/Model/Indexer.php:533]

22 Magento\Indexer\Model\Indexer#000000007761930800000000148a1009#->reindexList(array(84)) called at [vendor/magento/module-indexer/Model/Indexer/DependencyDecorator.php:282]

23 Magento\Indexer\Model\Indexer\DependencyDecorator#00000000776192d000000000148a1009#->reindexList(array(84)) called at [vendor/magento/framework/Indexer/AbstractProcessor.php:69]

24 Magento\CatalogInventory\Model\Indexer\Stock\Processor[Magento\Framework\Indexer\AbstractProcessor]#000000007761995300000000148a1009#->reindexList(array(84)) called at [vendor/magento/module-catalog-inventory/Observer/ReindexQuoteInventoryObserver.php:66]

25 Magento\CatalogInventory\Observer\ReindexQuoteInventoryObserver#00000000776192db00000000148a1009#->execute(&Magento\Framework\Event\Observer#000000007761930e00000000148a1009#) called at [vendor/magento/framework/Event/Invoker/InvokerDefault.php:88]

26 Magento\Framework\Event\Invoker\InvokerDefault#0000000077619c2400000000148a1009#->_callObserverMethod(&Magento\CatalogInventory\Observer\ReindexQuoteInventoryObserver#00000000776192db00000000148a1009#, &Magento\Framework\Event\Observer#000000007761930e00000000148a1009#) called at [vendor/magento/framework/Event/Invoker/InvokerDefault.php:74]

27 Magento\Framework\Event\Invoker\InvokerDefault#0000000077619c2400000000148a1009#->dispatch(array('instance' => 'Magento\CatalogI...', 'name' => 'inventory'), &Magento\Framework\Event\Observer#000000007761930e00000000148a1009#) called at [vendor/magento/framework/Event/Manager.php:66]

28 Magento\Framework\Event\Manager#0000000077619c2b00000000148a1009#->dispatch('sales_model_serv...', array('order' => &Magento\Sales\Model\Order\Interceptor#00000000776191b100000000148a1009#, 'quote' => &Magento\Quote\Model\Quote\Interceptor#0000000077619a3900000000148a1009#)) called at [generated/code/Magento/Framework/Event/Manager/Proxy.php:95]

29 Magento\Framework\Event\Manager\Proxy#0000000077619d2500000000148a1009#->dispatch('sales_model_serv...', array('order' => &Magento\Sales\Model\Order\Interceptor#00000000776191b100000000148a1009#, 'quote' => &Magento\Quote\Model\Quote\Interceptor#0000000077619a3900000000148a1009#)) called at [vendor/magento/module-quote/Model/QuoteManagement.php:581]

30 Magento\Quote\Model\QuoteManagement\Interceptor[Magento\Quote\Model\QuoteManagement]#00000000776198da00000000148a1009#->submitQuote(&Magento\Quote\Model\Quote\Interceptor#0000000077619a3900000000148a1009#, array()) called at [vendor/magento/module-quote/Model/QuoteManagement.php:456]

31 Magento\Quote\Model\QuoteManagement\Interceptor[Magento\Quote\Model\QuoteManagement]#00000000776198da00000000148a1009#->submit(&Magento\Quote\Model\Quote\Interceptor#0000000077619a3900000000148a1009#) called at [vendor/magento/framework/Interception/Interceptor.php:58]

32 Magento\Quote\Model\QuoteManagement\Interceptor#00000000776198da00000000148a1009#->___callParent('submit', array(&Magento\Quote\Model\Quote\Interceptor#0000000077619a3900000000148a1009#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]

33 Magento\Quote\Model\QuoteManagement\Interceptor#00000000776198da00000000148a1009#->Magento\Framework\Interception{closure}(&Magento\Quote\Model\Quote\Interceptor#0000000077619a3900000000148a1009#) called at [vendor/magento/framework/Interception/Interceptor.php:153]

34 Magento\Quote\Model\QuoteManagement\Interceptor#00000000776198da00000000148a1009#->___callPlugins('submit', array(&Magento\Quote\Model\Quote\Interceptor#0000000077619a3900000000148a1009#), array(array('validate_purchas...', 'update_bundle_qu...', 'coupon_uses_incr...'))) called at [generated/code/Magento/Quote/Model/QuoteManagement/Interceptor.php:68]

35 Magento\Quote\Model\QuoteManagement\Interceptor#00000000776198da00000000148a1009#->submit(&Magento\Quote\Model\Quote\Interceptor#0000000077619a3900000000148a1009#) called at [vendor/magento/module-quote/Model/QuoteManagement.php:414]

36 Magento\Quote\Model\QuoteManagement\Interceptor[Magento\Quote\Model\QuoteManagement]#00000000776198da00000000148a1009#->placeOrder(3084, NULL) called at [generated/code/Magento/Quote/Model/QuoteManagement/Interceptor.php:50]

37 Magento\Quote\Model\QuoteManagement\Interceptor#00000000776198da00000000148a1009#->placeOrder(3084) called at [vendor/magento/module-checkout/Model/PaymentInformationManagement.php:125]

38 Magento\Checkout\Model\PaymentInformationManagement\Interceptor[Magento\Checkout\Model\PaymentInformationManagement]#000000007761901100000000148a1009#->savePaymentInformationAndPlaceOrder(3084, &Magento\Quote\Model\Quote\Payment#000000007761903200000000148a1009#, &Magento\Quote\Model\Quote\Address\Interceptor#000000007761900600000000148a1009#) called at [vendor/magento/framework/Interception/Interceptor.php:58]

39 Magento\Checkout\Model\PaymentInformationManagement\Interceptor#000000007761901100000000148a1009#->___callParent('savePaymentInfor...', array(3084, &Magento\Quote\Model\Quote\Payment#000000007761903200000000148a1009#, &Magento\Quote\Model\Quote\Address\Interceptor#000000007761900600000000148a1009#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]

40 Magento\Checkout\Model\PaymentInformationManagement\Interceptor#000000007761901100000000148a1009#->Magento\Framework\Interception{closure}(3084, &Magento\Quote\Model\Quote\Payment#000000007761903200000000148a1009#, &Magento\Quote\Model\Quote\Address\Interceptor#000000007761900600000000148a1009#) called at [vendor/magento/framework/Interception/Interceptor.php:153]

41 Magento\Checkout\Model\PaymentInformationManagement\Interceptor#000000007761901100000000148a1009#->___callPlugins('savePaymentInfor...', array(3084, &Magento\Quote\Model\Quote\Payment#000000007761903200000000148a1009#, &Magento\Quote\Model\Quote\Address\Interceptor#000000007761900600000000148a1009#), array(array('validate-agreeme...'))) called at [generated/code/Magento/Checkout/Model/PaymentInformationManagement/Interceptor.php:23]

42 Magento\Checkout\Model\PaymentInformationManagement\Interceptor#000000007761901100000000148a1009#->savePaymentInformationAndPlaceOrder(3084, &Magento\Quote\Model\Quote\Payment#000000007761903200000000148a1009#, &Magento\Quote\Model\Quote\Address\Interceptor#000000007761900600000000148a1009#)

43 call_user_func_array(array(&Magento\Checkout\Model\PaymentInformationManagement\Interceptor#000000007761901100000000148a1009#, 'savePaymentInfor...'), array(3084, &Magento\Quote\Model\Quote\Payment#000000007761903200000000148a1009#, &Magento\Quote\Model\Quote\Address\Interceptor#000000007761900600000000148a1009#)) called at [vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php:95]

44 Magento\Webapi\Controller\Rest\SynchronousRequestProcessor#0000000077619e5800000000148a1009#->process(&Magento\Framework\Webapi\Rest\Request\Proxy#0000000077619d4d00000000148a1009#) called at [vendor/magento/module-webapi/Controller/Rest.php:188]

45 Magento\Webapi\Controller\Rest\Interceptor[Magento\Webapi\Controller\Rest]#0000000077619ed700000000148a1009#->dispatch(&Magento\Framework\App\Request\Http#0000000077619caa00000000148a1009#) called at [vendor/magento/framework/Interception/Interceptor.php:58]

46 Magento\Webapi\Controller\Rest\Interceptor#0000000077619ed700000000148a1009#->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#0000000077619caa00000000148a1009#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]

47 Magento\Webapi\Controller\Rest\Interceptor#0000000077619ed700000000148a1009#->Magento\Framework\Interception{closure}(&Magento\Framework\App\Request\Http#0000000077619caa00000000148a1009#) called at [vendor/magento/framework/Interception/Interceptor.php:153]

48 Magento\Webapi\Controller\Rest\Interceptor#0000000077619ed700000000148a1009#->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#0000000077619caa00000000148a1009#), array(array('append_nostore...'), array('webapiContorller...', 'configHash'))) called at [generated/code/Magento/Webapi/Controller/Rest/Interceptor.php:23]

49 Magento\Webapi\Controller\Rest\Interceptor#0000000077619ed700000000148a1009#->dispatch(&Magento\Framework\App\Request\Http#0000000077619caa00000000148a1009#) called at [vendor/magento/framework/App/Http.php:116]

50 Magento\Framework\App\Http\Interceptor[Magento\Framework\App\Http]#0000000077619c9100000000148a1009#->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:23]

51 Magento\Framework\App\Http\Interceptor#0000000077619c9100000000148a1009#->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]

52 Magento\Framework\App\Bootstrap#0000000077619c3f00000000148a1009#->run(&Magento\Framework\App\Http\Interceptor#0000000077619c9100000000148a1009#) called at [pub/index.php:29]

chequille commented 3 years ago

In fact, on my site in the template of the module Magento_Catalog product\list.phtml the method $_product->isSaleable() returns true even if salable quantity is 0

Does somebody have an idea to find out why this is the case, meaning how to debug it? I found this method in module-catalog\model\Product.php and compared it with my working 2.3.5-p2 installation but could not find any difference.

So, could somebody explain which functions/methods are called here? Where does MSI come in at all?

Any help would be very much appreciated. Do not want to wait again for the next release.

Thanks and best regards. Chequille

chequille commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

Hi @chequille. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @chequille, here is your Magento Instance: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering Admin access: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering/admin_3704 Login: 578dad99 Password: 466f25cb63e9

IanFiretoys commented 3 years ago

just wanted to chime in and say that we're experiencing this as well on 2.4.2 and 2.4.3 (we are using a database that was migrated from magento 1.9.3 in 2019 if that helps narrow it down).

we're having this issue in simples and configs where there's a saleable qty of 0 but a stock qty of >0 and a reservation for an order that hasn't been shipped yet. once the order gets shipped the logic of setting the simple product to out of stock seems to work. but it looks to us like it's only using the stock qty and not the saleable qty for this logic.

it's causing the most issues for customers in configs where the actual quantity in stock is less evident. whereas simples tend to display "0 in stock" and add to cart.

engcom-Alfa commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Alfa. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Alfa, here is your Magento Instance: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering Admin access: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering/admin_087f Login: 860c86e7 Password: 9ce348eb87e2

engcom-Alfa commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Alfa. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @engcom-Alfa, here is your Magento Instance: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering Admin access: https://5101128433fb0b25d09163620dddf00d-2-4-develop.instances.magento-community.engineering/admin_fcc9 Login: 0ae71a7f Password: 4d82dc128340

engcom-November commented 3 years ago

Hi @chequille , I verified the issue again on Magento 2.4-develop branch using same product "Impulse Duffle" by placing order with all quantity (say 100). Add to Cart button is removed only after re-indexing and clearing cache. Without reindex - On refresing the front-end - Add to cart button is displayed. After the indexers are reindexed and cache cleared - Add to Cart button is removed and "Out of Sock" status is displayed. image

image

chequille commented 3 years ago

As I said all the time !!!!!! What are you going to do? It is a bug!!!!!!

Janak29 commented 3 years ago

need to disabled saleable quantity related modules. or you need to truncate reservation table from magento. as we all know saleable quantity change instantly while quantity change after shipment generate. magento2 give option inside inventory setting change quantity when order placed but it's not useful . so there is temporary solution is truncate reservation table from database or disabled all inventory modules.

engcom-November commented 3 years ago

Verified the issue again on Magento 2.4-develop branch by placing order with all quantity (say 100). When Indexers are set to "Update by Schedule" (System - Index Management) and placed Order with all salable quantity - "Add to Cart" button is not getting removed in Product Details page even after Indexers are updated. Only on on Catalog Search Results page - "Out of stock" status is displayed. Hence this issue should be fixed. image image image image

chequille commented 3 years ago

Main Problem is, that method isSaleable is not returning false if salable quantity is 0 A part of the solution would be Pull request issue #33799 This changes Magento/InventoryIndexer/Model/IsProductSalable.php I am saying part of solution because it is only working if the view page of the product or the view page of the category is not cached.

On my site I set one block in calatog_product_view.xml and in catalog_category_view.xml to cachable="false"

WIth this, and the change in the above mentioned class "add to cart button" is not shown anymore if salable quantity is 0

If doing so no reindexing or cleaning cache is necessary. But the page is not cached and therfore a little bit slower.

Therefore, what must be found is to clean cache if salable quantity is going to 0 after an order was placed.

KM-HM commented 3 years ago

Is this not related or solved by #33911 ? Can't test it because the solution is not publicly available for #33911