Android Buy SDK Metafield Retrieve

sahil-mobi
New Member
2 0 0

Hi, 

 

can anyone explain how I can retrieve metafields using the buy sdk from a product. The doc suggests that metafield is a part of Product/ProductVariant but I am unabke to query when retrieving product details.

This is the query I use to fetch product details

 

val query = Storefront.query { rootQuery: Storefront.QueryRootQuery ->
rootQuery.node(ID(productId)) { nodeQuery: Storefront.NodeQuery ->
nodeQuery.onProduct { productQuery: Storefront.ProductQuery ->
productQuery.title().handle().description().descriptionHtml().images({ args: Storefront.ProductQuery.ImagesArguments -> args.first(10) })
{ imageConnectionQuery: Storefront.ImageConnectionQuery ->
imageConnectionQuery.edges { imageEdgeQuery: Storefront.ImageEdgeQuery ->
imageEdgeQuery.node { imageQuery: Storefront.ImageQuery ->
imageQuery.src()
}
}
}.tags().vendor().variants({ args: Storefront.ProductQuery.VariantsArguments -> args.first(10) })
{ variantConnectionQuery: Storefront.ProductVariantConnectionQuery ->
variantConnectionQuery.edges { variantEdgeQuery: Storefront.ProductVariantEdgeQuery ->
variantEdgeQuery.node { productVariantQuery: Storefront.ProductVariantQuery ->
productVariantQuery.sku().compareAtPrice().price().title().available().availableForSale().selectedOptions { selectedArg: Storefront.SelectedOptionQuery ->
selectedArg.name().value()
}.image { imageConnectionQuery1: Storefront.ImageQuery -> imageConnectionQuery1.src().id() }
}
}
}
}
}
}
Again, unable to find metafields. can you pls suggest what changes shud I make to the above query to retrieve metafields associated with the product as well. SDK Ver 3.1.2
0 Likes