通过Woocommerce Rest API列出订单

时间:2018-09-05 20:46:32

标签: php wordpress woocommerce woocommerce-rest-api

我正在尝试通过woocommerce rest api v2列出我商店中的所有订单或最近的100个订单。

我从https://github.com/kloon/WooCommerce-REST-API-Client-Library那里安装了官方框架

我设法列出我拥有的所有客户:

$ customers = $ woocommerce-> get('customers');

但是当我尝试列出每个文档中的所有订单

$ orders = $ woocommerce-> get('orders');

我得到一个错误:

Fatal error: Uncaught Automattic\WooCommerce\HttpClient\HttpClientException: The decoded property name is invalid in /home/xxx/xxx/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php:375 Stack trace:
#0 /home/xxx/xxx/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php(414): Automattic\WooCommerce\HttpClient\HttpClient->processResponse() 
#1 /home/xxx/xxx/vendor/automattic/woocommerce/src/WooCommerce/Client.php(82): Automattic\WooCommerce\HttpClient\HttpClient->request('orders', 'GET', Array, Array) 
#2 /home/xxxx/xxxx/index.php(27): Automattic\WooCommerce\Client->get('orders') 
#3 {main} thrown in /home/xxxx/xxxx/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php on line 375

0 个答案:

没有答案