Search code examples
wordpressrestwoocommercewoocommerce-rest-api

Is it possible to select more than one status in the WooCommerce API orders endpoint?


I am reading orders from a WooCommerce site with the REST API (v1, OAuth), filtering for order status:

http://mypage.com/wc-api/v1/orders?status=on-hold

Works fine.

Now I would like to filter for multiple statuses. Is this possible? Like:

http://mypage.com/wc-api/v1/orders?status=on-hold,pending

This site suggests so:

You can retrieve orders with a specific status using the ?status parameter, using commas to separate multiple statuses.

(I've already tried, but I was not able to build a valid oauth_signature with the comma, probably some kind of encoding issue. So before I keep trying, I would like to know if multiple statuses are possible in the first place.)


Solution

  • I finally found the reason for not being able to build a correct oauth_signature: the comma has to be double-encoded (see here for details).

    Answer: yes - it is possible to select multiple statuses comma-delimited just like that:

    http://mypage.com/wc-api/v1/orders?status=on-hold,pending
    

    This works in v1, v2 and v3.