Skip to content
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

Incorrect cataloginventory_stock_status.stock_status after stock item update by REST #39578

Open
1 of 5 tasks
zakdma opened this issue Jan 28, 2025 · 3 comments
Open
1 of 5 tasks
Assignees
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.x Indicates original Magento version for the Issue report.

Comments

@zakdma
Copy link
Contributor

zakdma commented Jan 28, 2025

Preconditions and environment

  • Latest vanilla Magento
  • Indexers in Update by Schedule mode (cron is configured to run)
  • Inventory modules are enabled
  • At least these consumers are enabled in env.php
    'cron_consumers_runner' => [
        'cron_run' => true,
        'max_messages' => 1000,
        'consumers' => [
            'product_action_attribute.update',
            'product_action_attribute.website.update',
            'exportProcessor',
            'codegeneratorProcessor',
            'negotiableQuotePriceUpdate',
            'quoteItemCleaner',
            'inventoryQtyCounter',
            'async.operations.all',
            'product_alert',
            'sales.rule.update.coupon.usage',
            'inventory.reservations.updateSalabilityStatus'
        ],
        'multiple_processes' => [

        ]
    ],
  • Stores/Configuration/Catalog/Inventory/Stock Options/Display Out of Stock Products => Yes

Steps to reproduce

  1. Create simple product with SKU test-stock
  2. Set Qty: 1 and Stock Status: In Stock
  3. Reindex all and clear cache
  4. Go to front and open test-stock product page
  5. See product is in stock and can be added to cart
  6. Add it to cart
  7. Proceed to checkout and place order using default shipping and billing methods
  8. Go to admin product grid and see product Quantity is 1 but Salable Quantity is 0 for Default stock
  9. Go to front and open/refresh test-stock product page
  10. See product displayed as Out of Stock and cannot be added to cart
  11. Run REST request to update product stock item
    curl -X PUT "https://domain.com/rest/V1/products/test-stock/stockItems/<stock_item_id>" -H "Authorization: Bearer " -H "Content-Type:application/json" --globoff -k --data-binary @- << EOF
    {"stock_item": {"qty": 1.0, "is_in_stock": true}}
    EOF
  12. Wait until indexers recalculated by a cron
  13. Go to admin product grid and see product Quantity is 1 but Salable Quantity is still 0 for Default stock
  14. Go to front and open/refresh test-stock product page

Expected result

Product should still be displayed as Out of Stock and can't be added to cart

Actual result

See product is displayed as In Stock and Add to Cart button is enabled
If you click Add to Cart button it cannot add it and error message displayed

Additional information

The problem is that after updating the stock item by REST API request field cataloginventory_stock_status.stock_status became 1 but it should remain 0 because the salable quantity is 0.
Manual reindexing of cataloginventory_stock indexer doesn't fix this bug. cataloginventory_stock_status.stock_status remain 1 after reindex.
It force us to resave product to correctly update salable status

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Jan 28, 2025

Hi @zakdma. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@github-project-automation github-project-automation bot moved this to Ready for Confirmation in Issue Confirmation and Triage Board Jan 28, 2025
@engcom-Hotel engcom-Hotel added the Reported on 2.4.x Indicates original Magento version for the Issue report. label Jan 28, 2025
@engcom-Delta engcom-Delta self-assigned this Jan 29, 2025
Copy link

m2-assistant bot commented Jan 29, 2025

Hi @engcom-Delta. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Delta
Copy link
Contributor

Hi @zakdma ,

Thanks for your reporting and collaboration.

We have tried to reproduce the issue in Latest 2.4-develop instance and we are not able to reproduce the issue.Kindly refer the screenshot.

Steps to reproduce

  1. Create simple product with SKU test-stock
  2. Set Qty: 1 and Stock Status: In Stock
  3. Reindex all and clear cache
  4. Go to front and open test-stock product page
  5. See product is in stock and can be added to cart
  6. Add it to cart
  7. Proceed to checkout and place order using default shipping and billing methods
  8. Go to admin product grid and see product Quantity is 1 but Salable Quantity is 0 for Default stock
Image
  1. Go to front and open/refresh test-stock product page
  2. See product displayed as Out of Stock and cannot be added to cart
  3. Run REST request to update product stock itemurl -X PUT "https://domain.com/rest/V1/products/test-stock/stockItems/<stock_item_id>" -H "Authorization: Bearer " -H "Content-Type:application/json" --globoff -k --data-binary @- << EOF
    {"stock_item": {"qty": 1.0, "is_in_stock": true}}
    EOF
Image
  1. Wait until indexers recalculated by a cron
  2. Go to admin product grid and see product Quantity is 1 as expected

Image

Can you please re-verify in latest 2.4 develop instance.

Thanks.

@engcom-Delta engcom-Delta added the Issue: needs update Additional information is require, waiting for response label Jan 29, 2025
@engcom-Bravo engcom-Bravo moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.x Indicates original Magento version for the Issue report.
Projects
Development

No branches or pull requests

3 participants