-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Product list does not contain extension_attributes stock_item #36615
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
Product list does not contain extension_attributes stock_item #36615
Conversation
Hi @Kannakiraj123. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review. For more details, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests 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. ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
…add_stockitem' into 2.4.develop_bugfix_product_list_add_stockitem
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.
Hi @Kannakiraj123,
Thank you for your contribution!
Could you please check my comment to the PR?
Also, regarding of definition of done I need to ask you to cover new functionality with auto-tests.
app/code/Magento/CatalogInventory/Model/Plugin/AddStockItemsProducts.php
Outdated
Show resolved
Hide resolved
Hi @sidolov, I saw your comments at #28435 and may disagree with the current implementation.
Missing inventory data in the collection load cause inconsistency in logic and also violate current documentation. My suggestion is to introduce such functionality (mentioned in this PR). The only I am not sure about is should stock data be loaded altogether with product collection in the Persistance layer (as it happens for a single product now) or should be moved to Service Layer (e.g. around Repository get list method). Your opinion is more than welcome here :) |
app/code/Magento/CatalogInventory/Model/Plugin/AddStockItemsProducts.php
Outdated
Show resolved
Hide resolved
@magento run all tests |
Any updates on above are the changes fine? |
@magento run all tests |
@magento run Database Compare, Functional Tests B2B, Functional Tests EE, Functional Tests CE, WebAPI Tests, Integration Tests |
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 failed tests seem flaky to me, hence approving the PR.
@magento run all tests |
Hi @Kannakiraj123, Thanks for the collaboration & contribution! ✔️ QA PassedPreconditions:
Steps to reproduce 1.Open the Postman Before: ✖️ ![]() After: ✔️ ![]() Builds are failed. Hence, moving this PR to Extended Testing. Thanks. |
@magento run all tests |
@magento run all tests |
@magento run all tests |
@magento run Database Compare, WebAPI Tests, Integration Tests |
@magento run all tests |
@magento run all tests |
Hello @Kannakiraj123, Thank you for your contributions. We are closing this PR because Magento has deprecated the stock item as an extension attribute. Additionally, it is causing a DB test failure and may even impact performance. Magento provides a separate API for retrieving stock-related data: Stock Items API. If you need stock information, you should load products using the repository and retrieve the stock data via the API in a separate request. Thank you again for your efforts! |
Description (*)
This pull request (PR) will be merge the added stock item extension_attributes in product list rest API /rest/V1/products?searchCriteria
Related Pull Requests
1.I added observer for "catalog_product_collection_load_after" in cataloginventory module.
Fixed Issues (if relevant)
Manual testing scenarios (*)
1.Open the Postman
2.Add the API URL: {baseurl}/rest/V1/products?searchCriteria
3.Method: GET
4.Authorization "Use Admin Token"
5.Check in response There is a "stock_item": object added in extension_attributes section.