• Resolved WP Native

    (@nazreenexe)


    Hello,

    As of now Woo returns the related product as an array of IDs. Instead of just IDs, Is there a way to retrieve the related product data (name, price etc…) in the rest api?

    Please do not comment pointing to the documentation link. I understand there’s a documentation for Woo REST API and I don’t find any relevant solution on this.

    https://prnt.sc/20sg80m

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @nazreenexe,

    Out of the box, there isn’t a way to do this. It will require either modifying what’s returned by the product endpoint or creating a new endpoint that returns exactly what you need.

    The WordPress Developer’s Handbook has a page about modifying responses that may be helpful to you:

    https://developer.wordpress.org/rest-api/extending-the-rest-api/modifying-responses/

    You could add a new related products section that includes not just the ID but also the title, price, slug, featured image, and anything else you need.

    I hope that gets you pointed in the right direction.

    Cheers

    Mirko P.

    (@rainfallnixfig)

    Hi there,

    We haven’t heard from you in a while, so I’m going to mark this as resolved. Feel free to start a new thread if you have any more questions.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Related products – Rest API’ is closed to new replies.