Implement Badges

If you have enabled Badges, then Constructor will include badge assignment in the API response for a search query or browse page.

Your team will be responsible for parsing the API response and deciding how badges display on an item listing page (PLP). This includes design aspects, such as what the badges will look like, and could include how many badges you wish to display per item.

The response format for a badge is as follows:

"results": [... 
  { "labels": { 
    # Context-based badges
    "__cnstrc_is_context_bestseller": { "display_name": "is_context_bestseller"}, 
    "__cnstrc_is_context_trending_now": { "display_name": "is_context_trending_now"} 
    # Global based badges
    "__cnstrc_is_new_arrivals": { "display_name": "is_new_arrivals"}, 
    "__cnstrc_is_bestseller": { "display_name": "is_bestseller"}, 
    "__cnstrc_is_trending_now": { "display_name": "trending_now"}
    }, ... 
  }, ... 
]

Note: If Constructor does not assign a badge to an item, then the labels field will be empty.