Customize the Commerce Search Results rendering to identify product bundles
You can modify the Commerce Search Results Scriban template in order to customize the output, for example, to add a Bundle tag for product bundles.
To add a custom label to identify product bundles:
-
In the Content Editor, go to /sitecore/Content/<tenant>/<site>/Storefront Dictionary.
-
Right-click Commerce Search Results and click Insert, Dictionary entry.
-
In the Message dialog box, enter a label, for example Bundle Label, and click OK.
-
On the Content tab, in the Data section, in the Key field, enter a name for the key you want to associate with the label, for example BUNDLE_LABEL.
-
In the Phrase field, enter the phrase you want to display, for example Bundle, and save your changes.
-
To modify the Commerce Search Results Scriban template, in the Content Editor, go to /sitecore/Content/<tenant>/<site>/Presentation/Rendering Variants/Commerce Search Results/Default/Scriban.
-
On the Content tab, in the VariantDetails section, in the Template field, insert the following code before the line
<div data-bind="css: { 'promotion': promotion }"
.RequestResponse{{ if string.contains i_item.template_name 'Bundle' }} <div data-bind="css: { 'promotion': promotion }" class="promotion"> <span class="savings-label">{{ sc_translate 'BUNDLE_LABEL' }}</span> </div> {{ end }}
-
On the ribbon, click Save.
-
Press F9 and publish your changes.