skip to Main Content

how can i get custom value(brand) from adobe via graphql
https://commerce.adobe.io/search/graphql
here is my query

query productSearch {
  productSearch(phrase: "bag") {
    total_count
    items {
      product {
        name
        sku
        custom_attributes {
          code
          value
        }
      }
    }
    facets {
      title
    }
  }
}

headers
{
"Magento-Environment-Id": "xxxxxxxxxxxxxxxxxxx",
"Magento-Website-Code": "base",
"Magento-Store-Code": "main_website_store",
"Magento-Store-View-Code": "default",
"X-Api-Key": "search_gql"
}
enter image description here

2

Answers


  1. Make sure brand is added to the search index and then you can request through graphQL request. Something like this.

    query productSearch {
     productSearch(phrase: "bag") {
      total_count
      items {
       product {
        name
        sku
        brand
        custom_attributes {
          code
          value
        }
       }
      }
      facets {
       title
      }
     }
    }
    
    Login or Signup to reply.
  2. You can’t (at least out of the box :/).

    You need to have installed catalog services and merge the query w/ another query to retrieve attributes.

    https://developer.adobe.com/commerce/services/graphql/catalog-service/products/

    To do so, you will also need to edit the external js to include your new graphql call:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search