我们一直在使用使用woocommerce rest api(php wrapper)创建的自定义脚本。运行正常。 但是今天突然停止了工作。
[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
我们的代码是这样的
$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);
如果我移除了'status' => $allowed_status,
,它将重新开始工作,但随后将获得所有订单。
woocommerce最近在代码中进行了任何更改。任何帮助将不胜感激。
Wordpress:5.4.2 Woocommerce:4.2.0