Open laryn opened 2 years ago
Related (noted by @argiepiano in shopify_sync_deleted_products
):
// There is an issue with how you are using page_info below. The Shopify API
// describes this as "page_info: A unique ID used to access a certain page of results."
// See https://shopify.dev/api/usage/pagination-rest
// The code here may be the result of an old REST API
// There are several steps to get pagination. You need to get the Link header
// and extract the page tokens from there.
// For the time being I have commented out all page related
// stuff in this function
// $options['page_info'] = $page;
From the wrapper API readme:
2019-07 API version introduced a new Link header which is used for pagination (explained here).
If an endpoint supports page_info, you can use $response->link to grab the page_info value to pass in your next request.
Example:
$response = $api->rest('GET', '/admin/products.json', ['limit' => 5]);
$link = $response['link']['next']; // eyJsYXN0X2lkIjo0MDkw
$link2 = $response['link']['previous']; // dkUIsk00wlskWKl
$response = $api->rest('GET', '/admin/products.json', ['limit' => 5, 'page_info' => $link]);