Solved

Query products by product_type using Apollo Client

workFlo
Tourist
11 1 0

Hello!
I am using the Apollo Client useQuery Hook to fetch my products from the store. I wrote a query which should get me all my products with a certain product_type. However, it does not seem to work. When I pass this query to the StoreFront API playground it seems to work tough. Anyone has an idea of why that could be? This is the query I am sending:

export const GET_PROUCTS = gql`
  query GetProducts {
    products(first: 250, query: "product_type:'bundle'", sortKey: TITLE ) {
      edges {
        node {
          id
          description
          title
          totalInventory
          images(first: 5) {
            edges {
              node {
                url
              }
            }
          }
        }
      }
    }
  }
`;

 

 

 

Also when I remove the tag it only returns me 14 products and not 250 as indicated.

Thank you for your support!

 

 

Accepted Solution (1)

workFlo
Tourist
11 1 0

This is an accepted solution.

Figure it out on my own -> seems like my products where only in the Shopify Playground sales channel but not in my store sale channel. So they did not appear when requesting them.

View solution in original post

Reply 1 (1)

workFlo
Tourist
11 1 0

This is an accepted solution.

Figure it out on my own -> seems like my products where only in the Shopify Playground sales channel but not in my store sale channel. So they did not appear when requesting them.