Legacy Knowledge Base
Published Jun. 30, 2025

API Response for commerce products with relationships does not contain manufacturerProducts nested fields

Written By

Sorin Pop

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • Steps to reproduce:
    1. Create a Minium site (so that you have products generated).
    2. Create a new object "manufacturer" (I set it to company scope, and to appear in Applications/Content - "Panel Link").
    3. I added a field "name" to it.
    4. I created a one-to-many relationship with the Commerce Product object.
    5. I created a new Layout for this object with a Fields tab showing the name field and a Relationship tab for the relationship defined above. Also set this layout to be the default one.
    6. Then I went to Applications/Content/Manufacturers and I created a new manufacturer "Audi" and I opened it, went to the relationship tab and added a couple of products here: ABS Sensor and Brake Fluid.
    7. I went to Commerce/Products and clicked on the ABS Sensor product. Noted down the ERC: MIN93015minium-initializer
    8. I went to the API GUI at /o/api and selected headless-commerce-admin-catalog.
    9. Scrolled down to the Product section and called the GET /v1.0/products/by-externalReferenceCode/{externalReferenceCode} API by providing the ERC above.
    10. From the response I searched for productId and noted it down,
    11. Then I expanded the GET/v1.0/products/{id} API
    Checkpoint: in the response example value we can see towards the ends lines like these:

    "r_manufacturerProducts_c_manufacturerERC": "string", "r_manufacturerProducts_c_manufacturerId": 0, "manufacturerProducts": {}

    12. Then I called this API with the productId from above.
    Result: at the end, the response only has this line

    "r_manufacturerProducts_c_manufacturerERC": "2368d06c-d32a-c6de-2985-24d2b99f70b2"


    Expected: it should also have those other two lines present and properly filled out (as the GUI example indicated before actually running the API)

Environment

  • 2024.Q1

Resolution

  • manufacturerProducts is an optional field. We do not return all the information by default to not overload the response. To retrieve the information, you have to add the nestedFields parameter to the request:
     
    nestedFields=manufacturerProducts

 

 

 

Did this article resolve your issue ?

Legacy Knowledge Base