New Shopify Certification now available: Liquid Storefronts for Theme Developers

Not all metafields returned on each product via graphql API (returns a maximum of 6) for dev store

wildabeast
Excursionist
16 0 9

I am running the following graphql query to obtain products and their metafields:

query productsByMasterTag($query: String!) {
  products(first: 28, query: $query) {
    edges {
      node {
        tags
        metafields(first:15) {
          edges {
            node {
              value
              key
              namespace
            }
          }
        }
        images(first:15) {
          edges {
            node {
              originalSrc
            }
          }
        }                        
      }   
    }
  }
}

 

When I run this from our front-end web app, we only receive a maximum of 6 metafields on each product, despite having 9 or more on many. When I run this same query in the Shopify GraphQL app, it returns all 9 or more metafields on each product. 

Is there some kind of limitation or permission that I need set to return more than 6? 

Also note that we have two stores (dev and production), and our production store does not exhibit the issue (returns all metafields on each product).

Replies 3 (3)
wildabeast
Excursionist
16 0 9

I think I've solved this myself. We were importing our product data using excelify, and the new product metafields weren't showing up in the graphql responses. It appears we needed to run a graphql mutation to set the metafield visibility. Here's what I ran:

mutation ($input: MetafieldStorefrontVisibilityInput!) {
  metafieldStorefrontVisibilityCreate(input: $input) {
    metafieldStorefrontVisibility {
      id
    }
    userErrors {
      field
      message
    }
  }
}

with input params:

{
  "input": {
    "namespace": "product",
    "key": "compatibility",
    "ownerType": "PRODUCT"
  }
}

 

Thanks to this post:

https://community.shopify.com/c/storefront-api-and-sdks/metafield-storefront-visibility-record/td-p/...

Renars
Shopify Partner
268 28 314

Hey @wildabeast 

Renars here from Matrixify (ex Excelify).

Thank you for mentioning us and sorry to hear about the trouble.
I have noted this issue in our future developments list to develop the ability in the app to bulk adjust the storefront visibility for Metafields.

Glad to hear that solution is found for now! 🙂

Matrixify | Bulk Import Export Update | https://apps.shopify.com/excel-export-import | https://matrixify.app
wildabeast
Excursionist
16 0 9

Sorry I made a mistake -- these records were imported through celigo rather than excelify.