如何通过 graphql 从 adobe 获取自定义值(品牌) https://commerce.adobe.io/search/graphql 这是我的查询
query productSearch {
productSearch(phrase: "bag") {
total_count
items {
product {
name
sku
custom_attributes {
code
value
}
}
}
facets {
title
}
}
}
标题 { "Magento-Environment-Id": "xxxxxxxxxxxxxxxxxxx", "Magento-网站代码": "base", "Magento 商店代码": "main_website_store", "Magento-Store-View-Code": "默认", “X-Api-Key”:“search_gql” }
确保品牌已添加到搜索索引中,然后您可以通过 graphQL 请求进行请求。像这样的东西。
query productSearch {
productSearch(phrase: "bag") {
total_count
items {
product {
name
sku
brand
custom_attributes {
code
value
}
}
}
facets {
title
}
}
}
你不能(至少开箱即用:/)。
您需要安装
catalog services
并将查询与另一个查询合并以检索属性。
https://developer.adobe.com/commerce/services/graphql/catalog-service/products/
为此,您还需要编辑外部 js 以包含新的 graphql 调用: