How to query graphql product list by automatic collection

duoweqi
New Member
1 0 0

Hello, I'm currently working on a mobile app. I want to get the product list by automatic collection's handle.

First,  I created a automatic collection in the shopify admin page :

duoweqi_0-1620918216754.png

Then, I got the automatic collection list:

 

{ 
  collections(first:250) {
    edges {
      node {
         id,
         handle,
         title
      }
    }
  }  
}

 

But, when I use the automatic collection's handle to query the product list, the result is incomplete:

 

{
  shop {
    collectionByHandle(handle: "frontpage") {
      id
      description
      products(first: 250) {
        edges {
          node {
            id
            description
            variants(first: 10) {
              edges {
                node {
                  id
                  sku
                  price
                  selectedOptions {
                    name
                    value
                  }
                }
              }
            }
          }
          cursor
        }
        pageInfo {
          hasNextPage
        }
      }
    }
  }
}

 

 It's works well for Manual collection, but not automatic collection.

So, how to query automatic collection's product list ?

Please help!

0 Likes