Search code examples
ruby-on-railsshopifyshopify-app

Shopify apps / oauth access / Get products correctly sorted from a collection


ProductsListing and CollectionListing aren't reachable from the oauth authentification (while building apps), those are reserved for plus-users.

The Smart collections of our store are sorted manually. I could not spot the correct way to retrieve the products of a collection correctly sorted

We're currently using the shopify_api gem, but searched a lot, unable to find out.

Thanks for your help


Solution

  • There is an endpoint labelled:

    /admin/smart_collections.json
    

    Where you can easily interact with your Smart Collections. For example, if your collection is set to manual sorting, there is a PUT resource you can create to change the order of products. In the Shopify API gem under resources you will find SmartCollection.

    To read products from your Smart Collection send the collection_id param to the Product endpoint. If Shopify does not return products in the collection sort order, you're screwed I guess.