Ron Kieftenbeld
Ron Kieftenbeld

Reputation: 29

Woocommerce rest API - get products by list of sku's

I tried to get product_details of a selected list of sku's out my woocommerce webshop by setting a list of sku's in the params of the call. When I use:

lst_of_skus = ['sku_1','sku_2']
response =wcapi.get("products", params={'sku':lst_of_skus}).json()
response

I only get a list with a dict of the last sku in the list. How can I get a list of dicts of all products in lst_of_skus

Upvotes: 0

Views: 753

Answers (1)

Krishna Singhal
Krishna Singhal

Reputation: 661

You can try this

skus =",".join(skus)
productlist=wcapi.get("products/?sku="+skus).json()
print(productlist)

Upvotes: 2

Related Questions