GraphQL Support
The extension implements two GraphQL queries: getCategoryBadgesPerProduct and getProductBadgesBanners.
getCategoryBadgesPerProduct
This call allows you to fetch the badges that should show up in the category and the CMS pages for the specified product IDs.
An example of the request:
{
getCategoryBadgesPerProduct(
cart_id: "FNALV4Ev5IQKp8bj0c5vEg12BLWCh4F9"
product_ids: [1903, 1896, 1588]
) {
items {
product_id
badges
}
}
}
The parameter cart_id is optional. If it is not provided, the response will be for a guest user. Otherwise, the response will return badges for the provided user cart.
An example of the response:
{
"data": {
"getCategoryBadgesPerProduct": {
"items": [
{
"product_id": 1896,
"badges": [
"https://www.magento.local/media/additional_promotions/sales_rule/badge_buy_x.png"
]
},
{
"product_id": 1903,
"badges": [
"https://www.magento.local/media/additional_promotions/sales_rule/badge_buy_x.png"
]
}
]
}
}
}
Note that the response doesn’t include the product 1588, because there are no category badges assigned to it.
getProductBadgesBanners
This call allows you to fetch the badges and banners that should show up on the product page of the provided product ID.
An example of the request:
{
getProductBadgesBanners(
cart_id: "Xm46ICr6VHCUtEyAeBOiiHxXNq7duljn"
product_id: 1903
) {
badges
banners
}
}
The parameter cart_id is optional. If it is not provided, the response will be for a guest user. Otherwise, the response will return badges and banners for the provided user cart.
An example of the response:
{
"data": {
"getProductBadgesBanners": {
"badges": [
"https://www.magento-24-4.local/media/additional_promotions/sales_rule/badge5.png"
],
"banners": [
"https://www.magento-24-4.local/media/additional_promotions/sales_rule/banner_get_y.png"
]
}
}
}