• linux4me2

    (@linux4me2)


    I’m using WooCommerce 3.0.1, version 2 of the WooCommerce REST API, and the WooCommerce REST API PHP Library.

    It works great to return an array of orders for a specific customer, but I’d like to be able to limit the orders endpoint to more than one status, specifically “processing” and “completed.” However, as far as I can tell from the docs, it’s only possible to use a single status (string) to limit the results.

    
    require __DIR__ . '/vendor/autoload.php';
    use Automattic\WooCommerce\Client;
    	
    $consumer_key = 'ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
    $consumer_secret = 'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
    $store_url = 'https://thedomain.com/';
     
    $woocommerce = new Client($store_url, $consumer_key, $consumer_secret, ['wp_api' => true, 'version' => 'wc/v2']);
    	
    $parameters = array('customer' => 4);
    		
    echo '<pre>';
    print_r($woocommerce->get('orders', $parameters));
    echo '</pre>';
    

    Is there some way to return more than one order status with v2 of the REST API using PHP?

  • The topic ‘REST API: More Than One Status For the Orders Endpoint?’ is closed to new replies.