Add a frequently bought together recommendation widget
Sitecore Discover offers a recommendation widget encouraging visitors to buy products that are frequently bought together on a product details page. Similar to other widget templates, it is built with UI components primitives and styles. You can edit the styles in these components or replace entire components.

The frequently bought together recommendation widget is a RecommendationContainer
containing the following two components:
-
PurchaseTogetherListView
- a list of product thumbnails and price details with an Add to cart button. -
PurchaseTogetherCheckboxList
- a product checklist that visitors use to include or exclude before clicking Add to cart.
To create a custom styled query hooked frequently bought together recommendation widget component:
-
In the UI components reference site, in the Widget templates section, open the Recommendation page.
-
In your React project, in the widget_components folder, create a folder named frequentlyBoughtTogetherStyled.
-
From the list of templates, on the Frequently Bought Together Styled page, click
index.js
to copy the code block. -
In the frequentlyBoughtTogetherStyled folder, create a JavaScript file called
index.js
, then paste the copied code block into it, and save. -
From the list of templates, in the Styled carousel section, click
styled.js
to copy the code block. -
On the Frequently Bought Together Styled page, create a JavaScript file,
styled.js
, then paste the copied code block into it, and save. -
In the
styled.js
file, edit the styled primitives, and save. -
In the component for the page details page, add a component as shown in the following code block.
RequestResponseimports RecommendationFrequentlyBoughtTogetherStyledWidget from "./widget_components/frequentlyBoughtTogetherStyled"; const PageDetailsPage = () => { ... ... return ( ... <RecommendationFrequentlyBoughtTogetherStyledWidget rfkId="frequently_recommendation" /> ... ) };
-
To avoid compile errors, update the imports section, and save.