Search code examples
pythonwoocommerce-rest-api

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


Solution

  • You can try this

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