Graphql query to retreive app data metafields?

Graphql query to retreive app data metafields?

Elloumi
Shopify Partner
2 0 1

I am working with app data metafields implementation, for now I was able to create app data metafields and use these metafields in Liquid... I just followed these documentation from Shopify... 


However I am not sure how to retreive these app data metafields in my application using graphql... there is no examples on Shopify website... Can anyone please guide me to implement the graphql query?

Many thanks and have a nice Sunday!!

Reply 1 (1)

oscprofessional
Shopify Partner
16366 2440 3188

Hi @Elloumi,

As you have not mentioned which metafield you want to retrieve. I am sharing you query to fetch all metafields(includes reference metafields) which will fetch all metafields assigned to product.

 

query ProductWithMetafields {
  products(first: 10) {
    edges {
      node {
        title
        metafields(first: 20) {
          nodes {
            namespace
            key
            reference {
              ... on Product {
                id
                title
              }
            }
          }
        }
      }
    }
  }
}

You can also retrieve metafield data for collections, customers and orders.

Please let me know if you are expecting something else.

 

Thanks...

Hire us | Pass Core Web Vital | B2B Wholesale Experts | Claim Your Free Website Review |
Connect with Us: WhatsApp | Skype: oscprofessionals-87 | Email: pallavi@oscprofessionals.com |
Custom Shopify SolutionsPrivate Apps, Theme Customization & SEO | Digital Marketing |
OSCP Apps: Discount Suite | Wholesale App | Bundle & Upsell | Shipping Discount | and more...