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.

Not able to enter product within Merchandise

Not able to enter product within Merchandise

Incentro
Shopify Partner
2 0 0

Dear Shopify Community,

 

I'm currently busy with setting up the queries for the cart of a customer. 

 

I want to get the products from the cart. My query has these fields: cart->lines->edges->node->merchandise-> product.

The query works and I get my data. But when I try to get to the merchandise part, there are no options to select .onProductVariant (just like at android). I can only call .self, because of this I can't get the products shown in the view. (see image)image.png

 

Let me know if you need more information.

 

Kind regards

Replies 2 (2)

c10s
Shopify Partner
67 12 27

You need to make sure in your actual Storefront GraphQL query you're including the fields, should look something like this:

 

query cart($id: ID!) {
  cart(id: $id) {
    lines(first: 50) {
      edges {
        node {
          id
          quantity
          merchandise {
            ... on ProductVariant {
              title
              product {
                title
              }
            }
          }
        }
      }
    }
  }
}

 

Incentro
Shopify Partner
2 0 0

Hi C10s,

 

My query looks like this:

Incentro_0-1650352511901.png

But unfortunately, it is still not possible to reach the .onproductVariant.