Narender Kumar
Narender Kumar

Reputation: 75

Bigcommerce Product API

I am using Big-commerce API version V2 and having a trouble to fetch multiple products with the help loop:

foreach ($fetchproducts as $product) {
  $productId = (string)$product->id;
  $options = Bigcommerce::getCollection('/products/'.$productId.'/skus?limit=5');
  print($options);
}

with above code I am able to fetch some of the products but not all. I want to fetch approx 250 products at once.

please help

Upvotes: 2

Views: 170

Answers (1)

Rajinder
Rajinder

Reputation: 1091

I am not sure but every platform has their own limit for API requests and you can try with 100 products

$i = 0;
foreach ($fetchproducts as $product) {
  $productId = (string)$product->id;
  $options = Bigcommerce::getCollection('/products/'.$productId.'/skus?limit=5');
  print($options);

  $i++;
  if($i == 100){
    break;
  }
}

you can try above code if it works then modify your data flow accordingly

I hope it helps

Upvotes: 2

Related Questions