Hello!
We’re currently developing a hydrogen store which heavily depends on metafields on each product on the store.
However, when adding a metafield to the product GraphQL query, the codegen that’s generating the types seems to fail since my variable name for the metafield doesn’t exist in the product schema.
const PRODUCT_QUERY = `#graphql
query Product(
$country: CountryCode
$handle: String!
$language: LanguageCode
$selectedOptions: [SelectedOptionInput!]!
) @inContext(country: $country, language: $language) {
product(handle: $handle) {
...Product,
metafield1: metafield(namespace: "custom", key: "produktype") {
value
}
}
}
${PRODUCT_FRAGMENT}
` as const;
This results in the type of the product to be “any”.
I’ve looked into fetching all metafields but this seems to be disabled in the latest API-version. Is there some fix to this or would it just be easier to downgrade the API version?
Thank you in advance.