How to get a one product information by ID from wcapi?

Viewed 124

I want to get a one product information by Id in wcapi(Module page).I use this code But dont work :/ and get all product information

from woocommerce import API
wcapi = API()
response = wcapi.get('products',params={'id':776}).json()
1 Answers

As other mentioned the API works as below:

/wp-json/wc/v3/products/<id>

So use the API as mentioned in the documentation and your code should be like below:

from woocommerce import API
wcapi = API()
response = wcapi.get("products/794").json()

Read more about the output here.

It's always a good idea to stick with documentation.

Related