I wrote this snippet in order to fetch all the products of a store,
using PHP Shopify SDK :
$productCount = $shopify->Product->count();
$limit = 250;
$totalpage = ceil($productCount/$limit);
for($i=1; $i<=$totalpage; $i++){
$params = array(
'limit' => '250',
'page' => $i
);
$products = $shopify->Product->get($params);
}
But I am getting only the first 50 products.
Do you have any suggestions on how to get them all?
Thanks in advance!
2
Answers
You have to pass page_info instead Of page in params and you will get page info from responses like :
for the first page, you have to pass in empty page_info.
I have created a function for our project that can fetch all resource items of a store. See example: