📌  相关文章
📜  woocommerce api 获取所有产品 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:24.140000             🧑  作者: Mango

代码示例1
$page = 1;
$products = [];
$all_products = [];
do{
  try {
    $products = $wc->get('products',array('per_page' => 100, 'page' => $page));
  }catch(HttpClientException $e){
    die("Can't get products: $e");
  }
  $all_products = array_merge($all_products,$products);
  $page++;
} while (count($products) > 0);