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
15961 2387 3095

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...

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free