php-shopify icon indicating copy to clipboard operation
php-shopify copied to clipboard

how can i get more than 250 order by request?

Open folex70 opened this issue 5 years ago • 5 comments

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!

folex70 avatar Oct 05 '19 20:10 folex70

Like this

$shopify->Product->get(['limit' => 250, 'page' => 2]);

aalwash avatar Oct 25 '19 09:10 aalwash

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

KuznetsEnvy avatar Nov 01 '19 17:11 KuznetsEnvy

Check the discussion in this issue about this subject https://github.com/phpclassic/php-shopify/issues/119

aalwash avatar Nov 02 '19 21:11 aalwash

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);

javimata avatar Nov 17 '20 16:11 javimata

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.

smoopins avatar Dec 15 '20 20:12 smoopins