Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Shopify API get products of custom collection pagination by page_info returned missing products

Shopify API get products of custom collection pagination by page_info returned missing products

issactran
Shopify Partner
8 0 1

Our app informations:

Shopify handle: product-filter-search
Shopify api key: d4172f8181a20b56ade67cc448fac594

 

We are using API: /admin/api/2021-07/collections/{collection_id}/products.json to get all products of the custom collection. Specifically for store: ca.lxrco.com, custom collection: https://ca.lxrco.com/collections/shop-sale-preloved-bags.json It has 869 products in this collection, but our app using this API got only 408 products.

 We are debugged for this API with a limit per page are 250 and see it only works for 2 pages: page 1 has 250 products, and page 2 has 158 products. In the response header for page 2, the field link does not have field next, which means no page info for the next, API returning 408 products,  x-request-id:"192ef857-aa99-415e-bc83-67cff7094d39"

Screen Shot 2022-06-26 at 2.00.00 PM.png

 

Thank in advance.

 

Replies 7 (7)

Alan
Shopify Staff
129 15 25

Hey @issactran - thanks for getting in touch. I can't say why this happened, but I was able to look up the request you had made using the request ID and it doesn't appear that there was an error with the API. 

Our recommendation would be to confirm that the collection ID number you're calling through the API is correct as it could potentially be that a different collection was returned rather than the expected one. Another possibility is that the merchant updated the collection recently and changed the amount of products in the collection. We're unable to access merchant data without approval from the merchant on our end (and they must contact us through our merchant support channels), so I can't confirm this, but if you are able to touch base to confirm the amount of products with your merchant and it still seems off, we can definitely take a further look into this with you. 

 

Hope this helps with some next steps - best!

 

 

Alan | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

lxrco
Visitor
3 0 0

Hi,

I work at the merchant in question here. How can i confirm this?

I chatted with support, spent an hour trying to explain the problem, and at the end the agent said we should take the conversation to email and he would loop in the app devs as well.

This was before noon. It's almost midnight here and I havent heard back.

So, how can we proceed so that someone helps us fix the issue at hand. What can i provide here?

Thanks,

Pablo / LXR

issactran
Shopify Partner
8 0 1

Hello @Alan,  We spent a lot of time figuring out this error before deciding to send a support request to Shopify, I can confirm the correct collection id is 284579070146, Shopify API returned data incorrectly. For example product with id is 6982740803778 belongs to collection 284579070146, but when using API /admin/api/2021-07/collections/{collection_id}/products.json to get all products of this collection it doesn't return the product id 6982740803778. Can you help us check why and confirm total 408 products of collection 284579070146 returned from API is true or false?

 

Products count of the collection got from store front 869

Screen Shot 2022-06-28 at 12.37.05 PM.png

Products counts of the collection got from Shopify API is 408Screen Shot 2022-06-28 at 12.40.02 PM.png Thank you

lxrco
Visitor
3 0 0

To further elaborate, we switched the Sale collection because of an upcoming promo, AND created a copy collection for testing purposes.

https://ca.lxrco.com/collections/shop-sale-preloved-bags
https://ca.lxrco.com/collections/fake-sale

JSON response for both files says 376 items. Also if i go to Products > Inventory > Export the products using the tag used on those collections, I also get 376 products.

Yet when i look at them online, one is showing 274 products, the other one around 290 products.

So again, something is messing up the numbers, and we can't continue having collections not show the real number of products they have.


issactran
Shopify Partner
8 0 1

@Alan It seems that this error has been updated by Shopify, the current results are the same when viewing the number of products of a collection directly from the store and from the Shopify API. 

We believe the data has been returned incorrectly before, please investigate it. We need answers for the customer, feel free to let me know what I can provide or help. Many thanks

 

Data view at the store:

Screen Shot 2022-06-30 at 1.32.22 PM.png

Data return from Shopify API:

Screen Shot 2022-06-30 at 1.36.28 PM.png

Alan
Shopify Staff
129 15 25

 

Hi - @issactran  I wanted to reach back out here to mention our Report an Issue form here at this link . I had been out of the office - so thank you for your patience on this. I read @lxrco 's reply and this form would be the best way forward to investigate the issue further if the issue still hasn't been resolved. If you are able to fill out the fields in that form as best you can - this would provide us some information to further investigate into the issue. This form will also provide you with an email thread which you can then loop the merchant into. Here, we'd then be able to get their permission to investigate the store info itself further.
 
In this case, continuing our investigation into this by email would be the next best step as we will be dealing with some sensitive information that may not be suited for a public audience like our community forums.
 
Hope to hear from you soon - if you need help with the form itself, just reply here - I'll make sure I am monitoring this thread for you in the meantime.


 

Alan | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

issactran
Shopify Partner
8 0 1

Thank you, @Alan 
I have submitted an issue report according to the link you provided