Search code examples
woocommercewoocommerce-rest-api

Is there any way to search products by name in WooCommerce API


I am trying to retrieve a product by name using WooCommerce API but I failed to do so.

Is there a way to find a product by its name?

Thank you.


Solution

  • I retrieve a product by name using the WooCommerce REST API with parameters. I used python for it. You can use a similar approach:

    def get_product_by_name(name):
        product_list = wcapi.get("products", params={'search': name}).json()
        count_of_items = len(product_list)
        ...
    

    name - product name(or part of name)