php-shopify
php-shopify copied to clipboard
how can i get more than 250 order by request?
Hello, how can i get more than 250 order by request?
In shopify community i found this solution:
GET /admin/products.json?limit=250&page=1 where page paramater is used for pagination.
but in this php version, how can i use this? Thanks!
Like this
$shopify->Product->get(['limit' => 250, 'page' => 2]);
How about new 2019-10 API version with Cursor Pagination? Is there support for that? https://help.shopify.com/en/api/guides/paginated-rest-results
Check the discussion in this issue about this subject https://github.com/phpclassic/php-shopify/issues/119
Some like:
$lastId = 1; $products = []; do { $results = $shopify->Product->get(['limit' => 250, 'since_id' => $lastId, 'published_status' => 'published']); $products = array_merge($products, $results); $lastId = end($results)['id']; } while (sizeof($results) > 0);
Hey all, I wrote this a bit ago when I needed to act on all objects in Shopify... and my project has me managing a LARGE catalog... https://gist.github.com/smoopins/a9bed4c1d51c30fd6e2aeccca38824ec
You can easily strip-out the type-check I've got in there, or you can do like me and implement an enum to verify that the types are valid for Shopify.