How to use DisplayTransformers
page_url
(presumably the case for most new customers), adding a DisplayTransformer is obligatory.
DisplayTransformers
can be leveraged to add extra data to your product, listings and content search results data before displaying it, in a batched way. This functionality is particularly useful when you have additional information stored in a different data source that you want to include in the display. Here’s how to do it:
DisplayTransformers
function. You’ll use the display’s product or listing IDs to fetch the corresponding data.@depict-ai/react-ui
) or DepictSearchProvider/DepictCategoryProvider (@depict-ai/js-ui
)@depict-ai/js-ui
only: displayTransformers
won’t be run for RecommendationSlider
and RecommendationGrid
, you’ll have to enrich the recommendations
data before passing it to the component.DisplayTransformers
Function Name | Options | Expected Return Type |
---|---|---|
products | { merchant: string, market: string, displays: YourDisplay[] } | Array of displays that have a page_url property. |
categories | { merchant: string, market: string, data: ProductListingWithAncestors[] | ListingSuggestion[] } | Array of ProductListingWithAncestors or ListingSuggestion that have a page_url property |
contentResults | { merchant: string; market: string; data: ContentLink[] } | ContentLink[] as received, value of fields can be modified |
variant_display
s so the InstantResult’s in the SearchModal to render properly:Property | Type |
---|---|
image_url or image_urls | string if former, string[] if latter |
original_price | number |
sale_price | number |
page_url | string |
title | string |
extra_value_promise
when it becomes available: