• Resolved pdqisrael

    (@pdqisrael)


    We’re using the WooCommerce API, and registering the order created webhook. We’re looking for a way to get a customer’s current orders count upon receiving a new order created webhook event. We were unable to find it in the API docs. Does the API currently provide a way of achieving that?
    Thanks

Viewing 1 replies (of 1 total)
  • There’s no direct API query to find the total number of orders by one particular customer. However, you could get there with a query like so:

    curl 'https://www.example.com/wp-json/wc/v3/orders?customer=123&consumer_key=CONSUMER_KEY_HERE&consumer_secret=CONSUMER_SECRET_HERE'

    Keep in mind that the default per_page value is 10, so that will return a max of 10 orders unless you push that parameter higher.

    Having said all that, usage of the API isn’t really something we can help too much with, since it by definition involves writing custom code to query it. Please see our WooCommerce Customizations page if you need more help.

Viewing 1 replies (of 1 total)
  • The topic ‘WooCommerce API – Get Customer’s Orders Count’ is closed to new replies.