Expand my Community achievements bar.

Customizing CIF Product Component to Query Custom Properties/Objects in AEM | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

Customizing CIF Product Component to Query Custom Properties/Objects in AEM by Bimmi Soi

Abstract

Understanding and modifying the GraphQL queries is one of the key ways in which the CIF Core Components can be extended.

Your custom query :

{
products(
filter: { sku: { eq: "YOUR_SKU" } }
) {
items {
name
sku
customProperty
customObject{
name,
code
}
}
}
}
Response :
{
"data": {
"products": {
"items": [
{
"name": "Product Name",
"sku": "sku",
"customProperty":"customVariableValue",
"customObject": {
"name": "nameValue",
"code": "codeValue",
}
}
]
}
}
}
In order to achieve that AbstractQuery (com.shopify.graphql.support.AbstractQuery) abstract class provides two methods to query custom property and object respectively.
addCustomSimpleField(String fieldName);
addCustomObjectField(String fieldName, CustomFieldQueryDefinition queryDef);

Read Full Blog

Customizing CIF Product Component to Query Custom Properties/Objects in AEM

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
0 Replies