Skip to content

Product list does not contain [extension_attributes][stock_item] #36533

@olsavmic

Description

@olsavmic

Preconditions and environment

  • Magento version 2.3.1, probably all newer versions affected as well 2.4-development

Steps to reproduce

Call /rest/V1/products?searchCriteria API, look for extension_attributes and compare the output with the API documentation

Expected result

stock_item should be part of extension_attributes in product listing

Actual result

stock_item is available only on the product detail

Additional information

I'd like to reopen the discussion around already existing but closed issues:
#24418
#22737

The official API documentation for /rest/V1/products endpoint contains stock_item record in the extension_attributes. The stock_item is indeed part of the /rest/V1/products/{productSku} extension_attributes.

From the comment and code on one of the issues, it seems like the stock_item field will be removed in the future and /stockItems/{productSku} endpoint should be used instead.

Since it took us hours to find out that the documentation is invalid, I'd propose one of following:

  1. Fix the API docs to reflect that the stock_item is missing from extension_attributes (although not ideal, the intent would be clear)
  2. Add stock_items (already tried in Fixed rest API products stockitem /V1/products?searchCriteria #22737  #28435, closed for inactivity)

Correct me please if the issue was fixed as I see #24418 in "status:done" (and I don't have a testing environment with the latest release) but I did not find any finished PR with the fix.

We'd highly prefer the option to get the stock_item information during product listing as we're integrating Magento with our ERP and right now we have to execute thousands of additional queries (I don't know of any bulk endpoint to retrieve the stock details for all products) but we can work with the workaround, fixing the docs would be enough if that's the agreed direction.

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”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: APIsComponent: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Priority: P3May be fixed according to the position in the backlog.Progress: doneReported on 2.3.1Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions