Skip to main content

How to Create a Product Page Cross-Sell Widget

Build a Product Cross-Sell widget for your Shopify product pages: create it, connect a Data Source, set the layout, and install it.

Written by Christian Sokolowski

A Product Page Cross-Sell widget shows product recommendations on your Shopify product pages, so a shopper looking at one product also sees complementary products they can add to the cart without leaving the page. This guide takes you from an empty widget to a live one: create the widget, connect a Data Source, set the layout, write the copy, install it in your theme, and turn on Live Mode.

Product Cross-Sell is the widget type name you will see in the Rebuy widget editor top bar, and it is the type behind every standard product page recommendation widget. A cross-sell adds the recommended product alongside what the shopper is already buying, so the cart ends up with both. It never swaps out the product they were looking at.

Requirement: Product Cross-Sell widgets live under Cart & Merchandising > Widgets in the Rebuy dashboard. Unlike a cart cross-sell, this widget does not require Rebuy's Smart Cart, because it renders on the product page itself rather than inside the cart.


Choose the right product page widget for the offer

Rebuy has four widget types that all appear on the product page, and they differ in how the shopper adds the products and in what happens to the cart. Pick the type before you start building, because the type is set at creation and cannot be changed afterward. The table below matches each goal to its widget type, then gives the shopper's add action and the result in the cart.

Your goal

Widget type

How the shopper adds it

What happens to the cart

Show complementary products the shopper can add

Product Cross-Sell (this guide)

Each recommended product has its own Add to Cart button

The recommended product is added alongside the product they were viewing

Offer a higher value alternative instead of the product they picked

Product Upsell

Each product has its own button

The original product is replaced by the upsold product

Offer accessories that get added together with the main product on one click

Rebuy Product Add-Ons

A checkbox per item, then your theme's own Add to Cart button

Every ticked add-on is added at the same time as the main product

Offer a set of products as a single bundle, at a bundle price

Dynamic Bundle

A checkbox per product, then the widget's own single Add to Cart button

Every ticked product in the bundle is added in one action

For an upsell build, see How To Create A Product Upsell Widget. For add-ons, see Create A Product Add-Ons Widget. For the full catalog of every Rebuy widget type, see Rebuy Widget Types.

This guide covers the embedded display style, which sits inline in the product page. If you want the recommendations to appear as a pop-up overlay when the shopper clicks Add to Cart, build the same widget type with Display Type set to Popup and follow How To Create A Product Cross Sell Pop Up Widget instead.


Step 1: Create the Product Cross-Sell widget

You create the widget from the Rebuy Widgets page by picking one of the Product Page starting configurations. Each configuration is a preset that fills in the endpoint and the default copy for you, and several of them create the same Product Cross-Sell widget type with different presets.

  1. In the Rebuy dashboard, open Cart & Merchandising > Widgets.

  2. In the Get Started section, click the Product Page card. If you have already created product page widgets, click New Widget at the top right instead. Both open the same list of starting configurations.

  3. Pick a starting configuration. AI Recommendations is the standard choice: it returns products that customers also bought based on the product being viewed.

  4. Click Create New on that card.

  5. Enter a descriptive name, such as PDP AI Recommendations, then click Create.

  6. The widget editor opens. Its top bar shows TYPE: Product Cross-Sell and the WIDGET ID you will need for installation.

Important: When creating a new widget, Live Mode is on by default, which means the widget becomes visible to shoppers the moment you install it in your Shopify theme. If you want to test before shoppers see it, toggle Live Mode off in the widget editor before you install, then use Rebuy Preview Mode to check it.


Step 2: Connect the Data Source

The widget's Data Source decides which products it recommends and whether the widget appears at all. A Product Cross-Sell widget renders whenever its Data Source returns at least one product, and hides itself when the rules return nothing, so the rules are your visibility control as well as your merchandising control.

  1. In the widget editor sidebar, find the DATA SOURCE section.

  2. Confirm the Endpoint dropdown points at what you want. It lists Rebuy's default endpoints and, below them, your own data sources as Custom Endpoints.

  3. To build your own rules, click Create new data source, or click Edit to open the connected custom data source in a new tab.

  4. Add the IF rules that decide when the widget should show, and the RETURN rules that decide which products it shows.

  5. Set Max Number of Products displayed to how many recommendations the widget should request. The maximum is 20 for a Product Cross-Sell widget.

  6. Save the data source, then return to the widget editor and click Save.

the widget editor sidebar DATA SOURCE section with the Endpoint dropdown, Edit link, Create new data source link, and the Max Number of Products displayed slider.

A widget created from the AI Recommendations configuration returns AI-driven recommendations based on the product being viewed, with no rules written at all. You only need rules when you want to control what appears in specific situations, such as returning Top Sellers for a product with no purchase history, or featuring one collection during a promotion. For the full rule reference, see Data Sources 101.

The input product is the product on the page

On a Product Cross-Sell widget, the input product is the product whose page the shopper is viewing. That single fact drives two behaviors worth knowing before you write rules.

  • Product-level IF rules evaluate against the viewed product. An IF rule on product tag, collection, vendor, price, or inventory is asking a question about the product on the page.

  • Filter input products keeps the viewed product out of its own recommendations. When Rebuy creates a data source alongside a new widget, Filter input products starts checked, so the widget will not recommend the product the shopper is already looking at. Leave it checked for normal recommendations. Uncheck it only when you deliberately want the viewed product returnable, such as returning it in a different variant.

Cart Rules work here, but they are evaluated at page load

Cart Rules are available on a Product Cross-Sell widget's Data Source and they do evaluate: Rebuy sends the shopper's cart with every widget request, whatever the widget type. A rule on cart subtotal, line item count, total item count, a specific product in the cart, or an applied discount code will match correctly on a product page widget.

What differs from a cart widget is timing. A Product Cross-Sell widget requests its products once, when the product page loads, so a Cart Rule is evaluated against the cart as it stood at that moment. The widget does not re-request when the shopper adds or removes items, so it cannot start or stop matching partway through the page visit. A cart cross-sell widget re-requests on every cart change, which is why an offer that has to react to the cart in real time belongs in the cart rather than on the product page. See How to Create an Embedded Cart Cross-Sell Widget for that build.


Step 3: Set the layout for each screen size

The Screens section of Widget Settings decides how the widget's products are laid out, and how many of them are on screen at one time on each device. It does not decide how many products the widget has to work with. That is Max Number of Products displayed, in the DATA SOURCE section from Step 2, and it is the setting that controls how many products the widget renders at all.

Treat the two as a request and a window. Max Number of Products displayed sets how many products the widget requests, up to 20. The Screens settings then decide how many of those the shopper sees at once, and whether the rest are reachable through carousel arrows or wrapped onto additional rows. Max Number of Products displayed is the ceiling on both: no layout setting can put more products on the page than the widget requested.

Screens holds one card per screen size, and each card has its own independent copy of every setting.

  • Large Screen applies to devices wider than 768px.

  • Medium Screen applies to devices between 481px and 768px.

  • Small Screen applies to devices 480px and narrower.

Changing Large Screen does nothing to how the widget looks on a phone, so configure all three whenever you change one. Each card holds the four settings in the table below.

Setting

What it does

Display Style

How each product is drawn: Grid, List, Line, or None. Setting it to None hides the widget entirely at that screen size.

Carousel

Turns the products into a horizontal slider with arrows instead of a block that wraps onto multiple rows.

Show Paginations

Adds pagination dots below the products. It only has an effect when Carousel is also on.

Grid Columns

How many products sit side by side, from 1 to 6. Whole numbers only.

Grid Columns and Carousel decide how many of the requested products are on screen at once. With Carousel on, Grid Columns is how many products are visible at one time, and the rest are reached with the arrows. With Carousel off, Grid Columns is how many products sit per row, and every product the widget requested renders, wrapping onto as many rows as it needs.

Worked example: Max Number of Products displayed is 8, and Large Screen is set to 4 columns with Carousel on. A desktop shopper sees 4 products, with the other 4 behind the carousel arrows. To show all 8 at once on desktop, either raise Grid Columns to 6 and accept a second row of 2, or turn Carousel off so the products wrap.

A Cross-Sell Widget's Screen settings showing Display Style dropdown, Carousel, Pagination and Grid Column options.


Step 4: Write the widget's copy

The Language tab holds every piece of text the widget displays, and the heading is what shoppers read as the section title on your product page. A new widget inherits its heading from the starting configuration you picked, so a widget created from AI Recommendations opens with "You may also like".

  1. In the widget editor, open the Language tab.

  2. Under General, set Title to the heading shoppers should see, such as Pairs well with this.

  3. Set Super Title if you want a smaller line above the heading, and Description if you want a sentence below it. Both can be left empty.

  4. Under Call to Action, adjust Add to Cart and the other button labels if your store uses different wording.

  5. Click Save.

The Widget's Language tab holds every piece of text the widget displays.


Step 5: Install the widget on your product page template

A Product Cross-Sell widget renders where you place it in your Shopify theme, so it does nothing until it is installed. Which method you use depends on your theme version, and the widget editor generates the exact code either way.

  1. Follow the installation guide. In the widget editor, click INSTALL in the top bar. You can also click Install on the widget's row on the Widgets page. Both open the same widget-specific installation guide.

  2. Install using the method that matches your theme:

  3. Save the theme and reload a product page on your storefront.

Access the Product Page Widget's Installation guide In the widget editor, click INSTALL in the top bar.

Reposition the widget after installing it

If the widget renders in the wrong spot, you can reposition it without editing your theme's code. There are two ways to do it, and on a 2.0 theme the first one is the one to reach for.

Drag the app block in Shopify's theme editor. This is the recommended method, because it needs no code at all. Your widget is an app block, so you move it the way you move any other block: in Shopify, go to Online Store > Themes > Customize, select your product template, find the Rebuy Widget block in the section list, and drag it up or down to where you want the recommendations to appear. Save the theme. Use this whenever the position you want is somewhere the block can actually be dragged to.

Use Dynamic Placement in the widget editor. Reach for this when dragging cannot get you there: the spot you want sits inside another section, or your theme is a vintage (1.0) theme with no app block to drag, or you need the widget in a different position on mobile than on desktop. In the widget editor, open Advanced > Dynamic Placement, then set two fields per screen size:

  • Placement Selector — a CSS selector for the element on your product page that the widget should attach to.

  • Placement Location — where the widget goes relative to that element: Before, After, Prepend, or Append.

Because this method needs a CSS selector read off your own storefront, it is the more technical of the two, and a selector that your theme later renames will silently stop working. For help finding the right selector, see Dynamic Placement Selectors.

Note: Dynamic Placement overrides the app block's position. If a Placement Selector is set, the widget moves itself to that selector on page load and ignores where you dragged the block in the theme editor. If dragging the app block appears to do nothing, open Advanced > Dynamic Placement and clear any selector left over from earlier troubleshooting.


Step 6: Test the widget, then turn on Live Mode

Testing before shoppers see the widget is the reason to turn Live Mode off in Step 1. Once the widget is installed and you are happy with it, Live Mode is what makes it public.

  1. With Live Mode off, open a product page on your storefront in Rebuy Preview Mode.

  2. Click Rebuy Data and confirm the widget's status is Ready. Ready means the widget initialized and its Data Source returned products.

  3. Check the widget on a phone as well as a desktop, because the Screens settings are configured separately per device size.

  4. Add a product from the widget and confirm it lands in the cart alongside the product on the page, rather than replacing it.

  5. Return to the widget editor and toggle Live Mode on. Click Save.

  6. Reload the product page as a normal shopper. The widget should now render for everyone.

If the widget does not appear at this point, work through the FAQ below before anything else, then see Why Isn't My Widget Showing?.


Optional: add a discount to the recommendations

You can attach a discount to a Product Cross-Sell widget so its recommended products display at a reduced price. Making the discount actually apply at checkout takes one setting beyond the amount itself.

  1. In the widget editor, open the Discount tab.

  2. Choose a Discount Type: Percentage, Fixed, or None, then enter the amount.

  3. Toggle Discounted By Functions on. This creates an automatic discount in Shopify scoped to this widget, so the discount applies when a shopper adds the product. Shopify Functions discounting is available on all Shopify plan types.

  4. Set Discounted From to Price or Compare at Price, depending on which value the discount should calculate against.

  5. Click Save.

If the Discounted By Functions toggle is left off, Rebuy shows the discounted price in the widget but the shopper is charged full price at checkout, because the widget's discount is display only in that mode. You would then need to create a matching discount in Shopify yourself. For the full picture, see the Rebuy Discounting Overview.

Toggle Discounted By Functions on. This creates an automatic discount in Shopify scoped to the widget


Widget editor settings that matter for a product page widget

The widget editor shows the same tabs for every widget type, and most of them are shared. The settings below are the ones that change how a Product Cross-Sell widget behaves on a product page.

Setting

Where it is

What it does

Display Type

Widget Settings > General

Embed renders the widget inline in the page. Popup renders it as an overlay that stays hidden until its trigger fires.

Max Number of Products displayed

DATA SOURCE section

How many recommendations the widget requests, up to 20.

Screens

Widget Settings > Screens

Display Style, Carousel, Show Paginations and Grid Columns, set separately per device size. See Step 3.

Enable Variant Selector

Widget Settings > Variant Selector

Shows variant options on the recommended products, and is on unless you turn it off. Variant Selector Type switches between a Select dropdown and swatch-style Buttons; Buttons requires Shopify options named "Color", "Colour", or "Size".

Add to Cart Redirect

Widget Settings > View Options

Where the shopper goes after adding from the widget: None (Stay on Current Page), Redirect to Cart, Redirect to Checkout, Close modal, or Create Draft Order.

Limit Views

Widget Settings > View Options

Caps how often one shopper sees the widget. Pair it with Max View Count and Every (in days).

Enable Timer

Widget Settings > Timer

Adds a countdown inside the widget. Timer Title, Minutes and Seconds set the text and duration. Action decides what happens at zero: Dismiss Widget removes the widget, Redirect to Cart, Redirect to Checkout, or Stop Timer leaves it in place at zero.

Enable Quick View

Product settings > Quick View Options

Lets shoppers open a product's details in a modal from inside the widget, without leaving the product page. When on, it is triggered by a button.

Match On Variant

Product settings > Product Options

Matches variant options such as color or size between the viewed product and the recommended products. It does not make the Data Source re-evaluate when a shopper changes variant on the page.

Theme and CSS

Styles tab

Colors, spacing, typography, and the widget's Custom CSS box.

Enable Attribution Tracking

Advanced > Product Properties

Tags items added from this widget so they appear in Rebuy reporting. It is on already, and should stay on.


Limitations

The following constraints apply to Product Cross-Sell widgets on the product page. Each has a workaround or an alternative where one exists.

  • The widget hides itself when its Data Source returns no products. If a correctly installed widget never appears, check the Data Source rules before anything else, using Previewing Data Sources.

  • Recommendations do not change when a shopper picks a different variant. The widget's input is the product, so its Data Source runs once at page load and does not re-run on variant change. To recommend a different product per variant, write one rule pair per case, using a specific-product IF and a specific-variant RETURN. There is no rule that reads the currently selected variant.

  • Cart Rules reflect the cart at page load only. They evaluate correctly, but the widget does not refetch when the cart changes, so an offer that must appear the moment a shopper crosses a spend threshold belongs in a cart widget instead.

  • A widget ID renders once per page. If the same widget ID appears twice on one page, in two app blocks or in an app block plus a manual container, Rebuy keeps the first placement in the page's document order and removes the rest from the page entirely. The removal is silent and the removed placement is not listed in Preview Mode. Duplicate the widget and give the second placement the duplicate's widget ID.

  • Grid Columns accepts whole numbers only. A half-item peek that hints at more products to scroll takes custom CSS; it is not a setting.

  • Custom templates are theme code, not an editor setting. A Product Cross-Sell widget renders with Rebuy's recommended template, and the widget editor has no field to change it. A developer overrides it by adding a template script tag to the theme, using the ID rebuy-widget-[WIDGET ID] to override that one widget or rebuy-recommended-template to override every widget on the page that uses the recommended template. See Widget Custom Templates. While a custom template is active, the editor's preview no longer matches what shoppers see.

  • The widget does not remove products or discounts. It adds to the cart and its involvement ends there. If a shopper adds a discounted product and then changes the cart so the rules no longer match, the product stays. For a reward that has to be withdrawn, build it as a Selectable Gift-With-Purchase widget.


Style the widget to match your store

The Styles tab gives you two ways to change how the widget looks, and one of them needs no code.

Set Theme to Custom for colors and button shape. Open the Styles tab and you will see a Theme selector with no styling fields under it. Switch Theme to Custom and the tab reveals a group of color pickers, plus two number fields for button geometry, covering most of what merchants want to change. Nothing here requires CSS.

What it styles

Fields

The widget's frame

Background Color, Border Color

The Add to Cart buttons

Button Background, Button Border Color, Button Text, and the only two fields that are not colors: Button Border Width and Button Radius. A border shows only while Button Border Width is above 0.

Carousel arrows and dots

Carousel Control Background, Carousel Control Text, Carousel Paging Dots

The widget's own copy

Title, Supertitle (spelled Super Title on the Language tab), Description

Each recommended product's details

Product Title, Product Description, Product Vendor

Prices

Price, Compare Price, Sale Price

Review stars, if a reviews app is connected

Reviews Background, Reviews Foreground, Reviews Text

The variant selector dropdown

Input Background, Input Border, Input Text

Use the CSS box for everything else. The CSS box sits in the same tab and stays available. Use it when the fields above cannot get you there, which in practice means spacing, font sizes and font families, hover states, and hiding an element. There are no spacing or typography fields in the Custom theme, so any type or layout change is a CSS change.

Note: CSS from this box is not scoped to the widget for you. Always scope your selectors to the widget ID, as in #rebuy-widget-12345 .primary-title, or the rule will reach other Rebuy widgets on the same page.

For ready-to-use snippets aimed at this widget, including product images, titles, prices and the Add to Cart button, see the Product Page Recommendation Widget CSS Styling Guide.


Extend the widget with custom JavaScript

Advanced > Callbacks runs your own JavaScript at specific points in the widget's lifecycle, which is how you reach behavior no setting exposes. The admin lists one section per event, each with an enable checkbox and its own code editor, and the editor only becomes editable once you enable that event.

These are the events most common for JS customizations on a product page widget:

Event

Fires when

What it is typically used for

ready

The widget has initialized and its products have rendered

Reformatting prices, hiding a returned product, adjusting markup after render

beforeReady

Products have been returned, before the widget renders

Reordering or filtering the returned products

beforeProductsChange

Before the displayed product set changes

Altering or emptying the product set before it renders

productsChange

After the displayed product set changes

Reacting to a new set of recommendations

beforeAdd

A shopper has clicked Add to Cart, before the add happens

Validating or blocking the add

add

A product has been added from the widget

Analytics, or a confirmation of your own

selectedVariantChange

The shopper picks a different variant in the widget's variant selector

Updating something alongside that selection

init

The widget initializes, before its data is fetched

The earliest available hook

view

The widget is viewed

Custom impression tracking

Important: Custom JavaScript is the first thing to rule out when a widget stops rendering. Code that throws inside a callback can leave the widget blank or stuck reinitializing, and it gives no setting-level symptom to find. When troubleshooting, disable the widget's enabled callbacks and reload the product page before you change anything else.

Custom JavaScript falls outside standard Rebuy support, as custom CSS and custom templates do. For what the widget instance exposes, see Widget Settings and Widget Methods in Rebuy's developer documentation. Rebuy's Partner team can connect you with an agency if you do not have a developer.


Frequently Asked Questions

Why does my product page widget show fewer products than I set it to?

When a Product Cross-Sell widget displays fewer products than you configured, the products are usually being returned correctly and the layout is showing only some of them at a time. Check these three things in this order:

  1. Carousel and Grid Columns, under Widget Settings > Screens. With Carousel on, Grid Columns is how many products appear at once and the rest sit behind the arrows. A widget returning 8 products with Grid Columns at 4 shows 4. You can raise the Grid Columns amount or turn the Carousel on.

  2. The screen size you are testing at. Each screen size has its own Carousel and Grid Columns values and they do not inherit from each other. A widget that shows every product on desktop can show a single product on a phone, because the Small Screen card is set separately and is often left at 1 column.

  3. Max Number of Products displayed, in the DATA SOURCE section. This caps how many products the widget requests at all, up to 20. If it is lower than the number you expect, the layout is not the problem.

The products are not lost in any of these cases. They are returned by the Data Source and present in the widget, and the layout is deciding how many sit on screen at once.

Can I change the recommendations based on the variant the shopper selects on the product page?

No, a Product Cross-Sell widget cannot change its recommendations based on the selected variant. The widget's input is the product, so its Data Source evaluates once when the page loads and does not re-run when the shopper switches variant. The Match On Variant setting matches variant options between the viewed product and the recommended products, but it does not make the rules re-evaluate.

The workaround is one rule pair per case: an IF rule naming the specific product, and a RETURN rule naming the specific variant to recommend. That has to be built product by product, so it suits a small catalog rather than a large one. If the offer can wait until the item is in the cart, a cart cross-sell widget does see the exact variant that was added.

Can I show the same product page widget in two places on one page?

No, you cannot use one widget ID twice on the same page. Rebuy renders one instance per widget ID and removes the extra placements from the page entirely, keeping the first one in the page's document order. The removal is silent and the removed placement is not listed in Preview Mode.

To show the same recommendations in two places:

  1. Go to Cart & Merchandising > Widgets.

  2. Open the actions menu on the widget's row and select Duplicate.

  3. Copy the duplicate's widget ID.

  4. Point the second placement at the duplicate's widget ID and leave the first placement on the original.

Both widgets can stay connected to the same Data Source, so the recommendations stay consistent while each placement keeps its own layout and settings.

Why isn't my product page widget showing on the storefront?

A Product Cross-Sell widget that never appears is almost always one of the following, in this order of likelihood:

  1. The Data Source is returning no products. The widget hides itself when its rules return nothing. Open the data source and check its rules against the product page you are testing, using Previewing Data Sources.

  2. Live Mode is off. A widget with Live Mode off renders only in Rebuy Preview Mode, not for shoppers.

  3. The widget is not installed on the product page template. Confirm the app block exists on the product template, or that the container is in the theme file.

  4. Display Style is set to None for the screen size you are testing. Under Widget Settings > Screens, a Display Style of None hides the widget at that screen size. A widget that shows on desktop but never on mobile is very often set to None on Small Screen.

  5. Display Type is set to Popup. A pop-up widget stays hidden until its trigger fires, so it will never appear inline no matter where it is installed.

  6. The product ID is not reaching the widget. Confirm Enable Product ID is checked on the app block, or that the manual container includes data-rebuy-shopify-product-ids="{{ product.id }}".

  7. The same widget ID is placed twice on the page. Rebuy renders one instance per widget ID and removes the rest.

  8. Limit Views has already been hit. If Limit Views is on and the shopper has reached Max View Count, the widget stays hidden until the window in Every expires.

For broader troubleshooting, see Why Isn't My Widget Showing?.

What is the difference between a cross-sell and an upsell on the product page?

A cross-sell and an upsell differ in what happens to the product the shopper was already buying. A cross-sell adds the recommended product alongside it, so the cart ends up with both. An upsell replaces it with the recommended product, so the cart ends up with only the upsold one. A Product Cross-Sell widget always adds. To replace, build a Product Upsell widget instead: see How To Create A Product Upsell Widget.

Can I style the product page widget beyond what the editor offers?

Yes, and the right tool depends on what you want to change. For colors and button shape, set Theme to Custom on the widget's Styles tab and use the fields it reveals, with no code involved. For spacing, typography and sizing, which have no fields, use the CSS box on the same tab, scoped to the widget ID. The Product Page Recommendation Widget CSS Styling Guide has snippets for each part of the layout. For structural changes, meaning different markup, extra elements, or rearranged product information, a developer can replace the widget's template entirely: see Widget Custom Templates. Custom CSS and custom templates fall outside standard Rebuy support, and Rebuy's Partner team can connect you with an agency if you do not have a developer.

Did this answer your question?