2
votes

I am trying to create a paginated shopify products page. I'm using the since_id strategy laid out in their docs: https://shopify.dev/docs/admin-api/rest/reference/products/product#index-2020-10

Using this endpoint, as explained in the docs:

/products.json?limit=5&since_id=${sinceId}

sinceId being the id of the last product on the previous page

The pagination seems to skip items. And it doesn't seem to be a set number of products that it skips. Sometimes it is just one. Others it can be up to 10.

Obviously, that makes the "pagination" not work.

I am aware of the link in the header solution. But wanted to know if anyone has experienced this issue with since_id?

1

1 Answers

6
votes

The Shopify docs do not mention this, but if you do not add since_id in your initial request, it will order items by title, not id.

If you want your first page to match the ordering of other pages, use since_id=0 on your first request. Note, the results will be ordered by id, not title. But they will* be ordered.