• Resolved projoomexperts

    (@projoomexperts)


    We have been using this custom script created using woocommerce rest api ( php wrapper ). It was working properly.
    But suddenly today, it stopped working.

    [11-Jun-2020 08:27:11 America/Denver] PHP Fatal error:  Uncaught Automattic\WooCommerce\HttpClient\HttpClientException: Error: Invalid parameter(s): status [rest_invalid_param] in /home/xxx/public_html/task/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php:350
    Stack trace:
    #0 /home/xxx/public_html/task/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php(386): Automattic\WooCommerce\HttpClient\HttpClient->lookForErrors(Object(stdClass))
    #1 /home/xxx/public_html/task/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php(422): Automattic\WooCommerce\HttpClient\HttpClient->processResponse()
    #2 /home/xxx/public_html/task/vendor/automattic/woocommerce/src/WooCommerce/Client.php(82): Automattic\WooCommerce\HttpClient\HttpClient->request('orders', 'GET', Array, Array)
    #3 /home/xxx/public_html/task/index.php(175): Automattic\WooCommerce\Client->get('orders', Array)
    #4 {main}
      thrown in /home/xxx/public_html/task/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php on line 350

    Our code is like this

    $allowed_status = array('pending', 'processing', 'on-hold', 'partial-complete');
    $param = [
        'per_page' => '100',
        'after' => $start,
        'before' => $end,
        'status' => $allowed_status,   
    ];
    
    $ca_orders = $castore->get('orders', $param);

    If i remove the 'status' => $allowed_status, , it starts to work again but then it gets all the order.

    Did woocommerce changed anything very recently in their code. Any help will be appreciated.

    Wordpress : 5.4.2
    Woocommerce : 4.2.0

Viewing 3 replies - 1 through 3 (of 3 total)
  • Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    Hey @projoomexperts,

    These forums are meant for general support with the core functionality of WooCommerce itself. For questions related to development and custom coding, your best bet is to ask on either the WooCommerce Advanced Facebook group or the WooCommerce Developer Slack.

    You’ll likely get more input and assistance in either of those spaces.

    Plugin Support Thu P. a11n

    (@thup90)

    Hi there,

    I hope you found the previous reply helpful. We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Thread Starter projoomexperts

    (@projoomexperts)

    Hi, though your support staffs reply didn’t solve my problem at all. After some digging by myself , I figured it out.

    The issue occured because of another woocommerce plugin named “woocommerce partial shipment” , They used to use the order status ‘partial-complete’ but in newest release they changed it to ‘partial-shipped’ , that is why the old status that i was using in my api code became invalid. I don’t know why they did it but it was not a good move i guess.

    If the error message could specifically say which status became invalid , it would be more easier for us to understand.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error: Invalid parameter(s): status [rest_invalid_param]’ is closed to new replies.