Woocommerce订单/产品剩余API通过元数据过滤数据

时间:2018-12-21 09:20:18

标签: rest api woocommerce wordpress-rest-api woocommerce-rest-api

我想通过客户元键过滤订单列表。

https://www.plazaetc.com/wp-json/wc/v3/orders?filter[meta]=true&consumer_key=ck_my_key&consumer_secret=cs__my_key

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.plazaetc.com/wp-json/wc/v3/orders?filter[meta]=true&consumer_key=ck_my_key&consumer_secret=cs__my_key",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache",
    "postman-token: 5be26272-bc54-1d0a-397c-7314ad1331df"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

预期结果仅根据我的客户元键和值所在的位置来过滤数据。

或建议用于记录的过滤器的其他替代代码。

0 个答案:

没有答案