Query doesn't work in Checkout UI Extension

I added a app extension, Checkout UI, but it gets no response to query product variant data. and I can get data in GraphQL center with the same query, variant id is from “extensions.settings.fields”, did I miss something?

In addition, official docs all use JSX, but TSX is now popular. If you modify the code to the TSX version, the query will also become invalid.:upside_down_face:

Hi @Zara, did you add api_access to the TOML file?

Sure, and I use this query, it can get data. but I add variants in query, it will not work.

{
  products(first: 5) {
    nodes {
      id
      title
    }
  }
}

Sounds like its going to be something straight forward but annoying.

Try logging merchandiseId to the console, if its empty, then you know there is an issue when you get the value from the settings. It should come from useSettings().

Is there any response from the graphql query? It might be the case that the variable is not published on the Online Store, double check that its published to Online Store.

Feel free to DM more of the code if you want.

@Bsmubbs Thanks for replying.

I seem to know the problem. It may be because the API version is different and the format requirements for outputting price are also different.

should be price { amount currencyCode }

But It can only use price in GraphQL center, not Money V2

1 Like