Rebuy widgets inherit their colors, fonts, and buttons from your Rebuy Theme, and you can go further with custom CSS (Cascading Style Sheets) to control almost any visual detail. This guide is the starting point for styling Rebuy widgets: it covers where CSS goes, how to scope it to one widget or every widget, and how to test it. If the widget you want to style has its own dedicated CSS guide, use the table below to jump straight to it.
Widget-Specific CSS Guides
Several Rebuy widgets have their own dedicated CSS guide with selectors and recipes specific to that widget. Find your widget in the table below to go straight to its guide, or keep reading for the CSS fundamentals that apply to every widget.
Rebuy Feature | CSS Guide |
Smart Cart | |
Legacy Smart Cart | |
Cart Cross-Sell Widget | |
Product Add-Ons Widget | |
Dynamic Bundle Widget | |
Product Page Recommendation Widget (Product Cross-Sell Widget) | |
Pre-Purchase Widget (Pop-Up) | |
Buy More Save More (BMSM) Product Page Widget | |
Smart Search | |
Smart Collections | |
Smart Flows (popups, banners, product modals) | |
Bundle Builder |
Which Rebuy Widgets Support Custom CSS
Most Rebuy widgets support custom CSS, and you can confirm any individual widget by opening it and looking for a Styles tab with a Custom CSS box. If that box is not there, custom CSS is not supported for that widget type.
Post-Purchase widgets and Checkout Extension widgets are the two exceptions. Neither includes a Custom CSS box, because both run inside Shopify's sandboxed checkout environment (Shopify Checkout Extensibility), which blocks custom CSS and JavaScript to keep checkout secure and compliant. Their appearance comes from your store's Shopify Checkout branding instead, which you set in your Shopify Admin under Settings > Checkout > Customize.
Here is what you can control for each of those two widget types:
Widget type | What you can change | Where to change it |
Post-Purchase widget | Star rating colors accept any hex value. Description text is limited to 5 preset colors, and the Timer to 4 preset styles. Titles, headings, and the Banner have fixed colors. | Rebuy widget editor, plus Shopify Settings > Checkout > Customize for the Pay button, page background, and fonts. See Post-Purchase Offer: Color & Styling Guide. |
Checkout Extension widget | Logo, header, background, accent, button, and error colors. Custom CSS and JavaScript are not available, and elements cannot be hidden with CSS. | Shopify Checkout Editor. See Shopify Checkout Extensions. |
How CSS Works with Rebuy Widgets
Custom CSS for Rebuy widgets is loaded by Rebuy itself, not by your Shopify theme, so you never edit theme files to style a Rebuy widget. Rebuy adds your CSS to the page as an ordinary stylesheet, which leads to the most important thing to understand before writing any: your CSS is not automatically limited to the widget you added it to. Limiting it is something you do yourself, in every selector you write.
Check Your Rebuy Theme Settings First
Before writing any CSS, check whether your Rebuy Theme already has a setting for the change you want, because a theme setting is easier to maintain than custom CSS. Your Rebuy Theme controls button background, border color, border width and radius, price and sale price styling, input field colors, super title, title, description, product title, product review colors, carousel controls, and the Smart Cart banner and timer colors. Every widget you create inherits those settings automatically.
To open your Rebuy Theme, go to your Rebuy admin Settings page and click Themes. For the full list of available settings, see Manage Rebuy Theme.
Reach for custom CSS when the change you want is not covered by a theme setting, such as spacing, font family, text alignment, widget width, mobile-only styling, or hiding an element.
Every Custom CSS Box Applies to the Whole Page
A Custom CSS box controls which pages your CSS loads on, not which elements it is allowed to change. Once your CSS loads on a page, it applies to everything on that page, exactly like any other stylesheet on your store.
This catches people out most often with a widget's own Custom CSS box. Adding CSS there does not confine it to the widget. For example, if you add this CSS to a widget that sits on your home page, every heading on your entire home page turns red, not just the widget's heading:
/* Applies to EVERY h2 on the page, not just the widget */
h2 {
color: #ff0000 !important;
}
To limit your CSS to one widget, prefix the selector with that widget's ID:
/* Applies only to this widget's primary title */
#rebuy-widget-12345 .primary-title {
color: #ff0000 !important;
}
Important: scope every selector with its widget id number, for example #rebuy-widget-12345, even when you are adding it inside that widget's own Custom CSS box.
Where You Can Add Custom CSS
Rebuy gives you two places to add custom CSS, and the difference between them is which pages your CSS loads on, not what it can reach. The table below shows when each one loads and what to use it for.
Location in the Rebuy admin | Loads on | Use it for |
Settings > Themes > Custom CSS | Every page where Rebuy loads | Styling you want available store-wide, across all widgets and the Smart Cart |
A widget's editor | Only the pages where that widget renders | Styling meant for a single widget, still scoped with that widget's ID |
Locating the custom CSS editor for some Rebuy features such as the Smart Cart, Smart Search, Smart Collections, Smart Flows, and Bundle Builder is different. Each one has its own CSS editor inside its own settings. Use the Widget-Specific CSS Guides table at the top of this article to open the correct guide.
Best practice: keep store-wide styling in the Rebuy Theme and single-widget styling in that widget's Styles tab. Both boxes behave identically once loaded, so this split is about keeping your CSS easy to find later, not about limiting what it can change.
When two selectors target the same element, the more specific selector wins, which is standard CSS behavior. A selector scoped to a widget ID such as #rebuy-widget-12345 .primary-title overrides one written as .rebuy-widget .primary-title, because an ID selector is more specific than a class selector.
How to Add CSS to a Single Widget
These steps apply to widgets you create and manage in the Widgets list. Keep in mind that this box loads your CSS on every page where the widget renders, so scope each selector with the widget's ID to keep it from changing the rest of the page. Follow these steps:
Go to Cart & Merchandising > Widgets and click the widget you want to style.
Open the widget's Styles tab.
Paste your CSS into the Custom CSS box.
Click Save, then refresh your live storefront page to see the change.
If the widget's changes do not appear after saving, see the Testing Your CSS Changes section later in this guide.
Finding Your Widget ID Number
Almost every CSS snippet in this guide needs your widget's ID number, and the Rebuy admin shows it in a few places.
In the widget editor. Open the widget you want to style and look at the top bar, which displays WIDGET ID: followed by the number. Click the copy icon next to it to copy the ID, which saves you from mistyping it.
(Screenshot example above: a widget editor top bar showing the widget ID)
In the Widgets list. Go to Cart & Merchandising > Widgets in the Rebuy admin. Every widget's ID appears in the ID column beside its name. If your list is long, type the widget's name into the search field to filter down to it.
(Screenshot example above: Widgets listed with the ID column)
Once you have the number, drop it straight into the selector. A widget with ID 300516 becomes:
/* Widget primary title */
#rebuy-widget-300516 .primary-title {
color: #7a4a39 !important;
}
How to Add CSS to Every Widget at Once
To apply one CSS change to every widget on your store, add the CSS in your Rebuy Theme rather than in an individual widget, and target the .rebuy-widget class instead of a specific widget ID. Go to your Rebuy admin Settings page, click Themes, scroll to the Custom CSS box, add your CSS, and click Save.
Prefix the element you want to style with .rebuy-widget:
/* Applies to the primary title of every Rebuy widget */
.rebuy-widget .primary-title {
text-align: center;
}
Important: CSS written this way affects every widget you have now and every widget you create in the future. Keep the .rebuy-widget prefix on it, because CSS in the Rebuy Theme loads on every page where Rebuy loads, and dropping the prefix would let your styling reach non-Rebuy elements across your store. If you later want one widget to look different, add widget-specific CSS in that widget's Styles tab, which overrides the store-wide styling because it is more specific.
How to Write CSS for a Rebuy Widget
Every piece of CSS you write has the same two parts, a selector and one or more properties, so learning those two terms is enough to write and adapt your own CSS.
Selector. The selector is what you are styling. In #rebuy-widget-12345 .primary-title, the .primary-title class is the element being targeted and #rebuy-widget-12345 limits the change to that one widget. Replace 12345 with your own widget ID number.
Properties. Properties are the changes you are making, and they go inside the curly brackets that follow the selector. In #rebuy-widget-12345 { background: #ffffff; }, background is the property and #ffffff is its value, which sets that widget's background to white. Every property and value pair needs a semicolon after it.
For a wider range of unique CSS properties, explore further at:
Comments. Anything wrapped in /* and */ is a comment, which does not run as code. Comments label what a block of CSS does. Keeping the comments when you copy CSS from a Rebuy guide makes it far easier to revisit months later.
The !important flag. Adding !important before the semicolon forces your styling to apply even when your Shopify theme is trying to style the same element. It is not always necessary and meant to be used only when necessary.
Finding the Right Selector with Inspect Element
Your browser's developer tools show you the exact class name of any element you want to style. Right-click the element on your live storefront, choose Inspect, and read the class name on the highlighted element in the panel that opens. Use that class name as your selector, scoped to your widget ID.
Using AI Tools with Rebuy's Developer Documentation
Rebuy publishes its developer documentation as machine-readable files built for AI assistants, which gives you a practical way to look up a widget's class names and draft CSS without reading every reference page yourself. This is a developer resource, so treat whatever an AI tool produces as your own code and test it before putting it on your live store. The full walkthrough lives in Rebuy's AI Integration Guide.
Rebuy's Machine-Readable Documentation Files
Rebuy offers two files, and which one you use depends on how much context your AI tool can hold at once. The table below compares them.
File | What it contains | Best for |
A compact index of every documentation page, with a short description of each | Everyday questions, and tools with a smaller context window | |
A complete dump of the documentation | Detailed work where you need the actual template markup and class names |
For CSS work specifically, llms-full.txt is the more useful of the two, because it contains the widget template markup itself rather than only page descriptions.
Using It to Confirm a Widget's Class Names
Because the documentation includes Rebuy's widget template markup, an AI assistant with that documentation loaded can tell you which class names a given widget type actually renders, which is a fast way to check a selector before you write CSS against it. Ask the assistant to quote the template markup rather than describe it, then confirm the class name yourself with Inspect on your live storefront before relying on it.
Note: Smart Cart V2 templates are managed in the Rebuy admin rather than in code, so the developer documentation does not contain template markup for them. To style your Smart Cart, use the Smart Cart CSS guide listed at the top of this article.
Testing Your CSS Changes
Always confirm your CSS on your storefront rather than in the widget editor's preview, because the two render in different environments and can look genuinely different. The sections below explain why that happens, how to check your CSS without showing work in progress to shoppers, and what to do when a change does not appear.
Why the Editor Preview Looks Different from Your Storefront
The widget editor's preview renders your widget inside the Rebuy admin, not on your storefront, so your Shopify theme's CSS is not loaded around it. On your real storefront both stylesheets are present at once, and they compete: where your theme targets the same element as your CSS, whichever selector is more specific wins. The preview has no theme styling to compete with, so it cannot show you the result of that competition.
That difference cuts in three directions:
Styling that looks correct in the preview can be overridden on your storefront, because your theme is targeting the same element more specifically. This is the situation
!importantis for.Text can appear in the wrong font in the preview, because Rebuy widgets inherit your theme's font by default and the preview has no theme font to inherit.
Unscoped CSS looks harmless in the preview, because there are no theme elements there to break. A selector such as
h2 { }only reveals what else it changed once you view the real page.
Preview Your CSS Without Showing It to Shoppers
Saving CSS to a widget that is already live puts that CSS on your storefront immediately, because widget CSS has no draft state. There are two ways to see your changes on a real page with your theme's CSS loaded, without shoppers seeing them:
Rebuy Preview Mode, best for a widget you have not launched yet. In the widget editor, toggle Live Mode off, then click PREVIEW in the top bar. You can also add
?preview=trueto the end of your store URL, or click ONLINE STORE from the Rebuy admin Dashboard. You will know it is active when the Rebuy preview bar appears at the bottom of your browser showing Widgets. The widget has to already be installed on your theme to appear.A duplicate theme with Rebuy installed, best for a widget that is already live, since taking a live widget out of Live Mode also removes it from your storefront for customers.
While you are in preview mode, click Toggle Highlight in the Rebuy preview bar to put a colored border around every Rebuy element on the page. That is the quickest way to tell which elements Rebuy controls and which belong to your theme before you decide what to target.
For the full walkthrough of both methods, including Smart Cart and draft themes, see Using Rebuy preview mode.
If Your CSS Is Not Rendering
When a change does not appear on your storefront, work through these checks in order:
Confirm you replaced
XXXXXor12345with your widget's actual ID number in every selector.Confirm proper CSS Syntax, for example every property and value pair ends with a semicolon.
Add
!importantbefore the semicolon, in case your Shopify theme is overriding your styling.Right-click the element, choose Inspect, and confirm the class name you targeted matches the class name in the developer tools panel. In your browser's developer tools, a style that is being overridden appears with a line through it, which tells you the conflict is specificity rather than a typo.
In that same panel, check which stylesheet the winning style came from, because the conflict is often not in the widget you are editing. See Common Sources of a Conflicting Style below.
Clear your browser cache and refresh, or open the page in a private browsing window.
Common Sources of a Conflicting Style
When CSS looks correct but still does not apply, the style beating it usually comes from somewhere other than the widget you are working in. In your browser's developer tools Styles panel, every style targeting the selected element is listed top to bottom in winning order, and each one shows the stylesheet address it came from on its right. That address is what tells you where to go and fix it. The table below covers the four sources you will see on a Rebuy widget.
Address shown in the Styles panel | What it means | How to fix it |
Starts with | A widget's own Styles > CSS box. If that ID number is not the widget you are editing, another widget's CSS is reaching yours | Open the widget with that ID number and scope its CSS with its own |
Starts with | Your Rebuy Theme's Settings > Themes > Custom CSS, which loads on every page where Rebuy loads | Scope the Rebuy Theme CSS more narrowly, or move it into a single widget's Styles tab |
A Rebuy file ending in | Rebuy's own built-in styling, which you cannot edit | Override it with CSS scoped to your widget ID, which is more specific than Rebuy's defaults |
One of your Shopify theme's CSS files, such as | Your theme's styling, which also reaches Rebuy widgets because Rebuy renders standard HTML elements on your page | Edit or remove it in your theme, or make your selector more specific and add |
The first source is the one that surprises people most. Because every Rebuy CSS box loads page-wide, an unscoped selector sitting in one widget's box restyles every other Rebuy widget on the same page. If two of your widgets keep affecting each other, check both of their CSS boxes for selectors that are missing a #rebuy-widget- prefix.
Your theme reaches in the other direction as well. A Rebuy widget's title renders as a real heading element on your page, so styling your theme applies to every heading of that level also lands on the widget's title. That is the second reason to scope your CSS to a widget ID: it keeps your CSS off your theme, and it makes your CSS specific enough to win against your theme's.
Customizing Widgets Beyond CSS
If you need to change a widget's structure or content rather than its appearance, custom widget templates go further than CSS. See How To Create A Custom Template For A Rebuy Widget.
Frequently Asked Questions
Why isn't my CSS change showing up on my Rebuy widget?
The most common reasons a CSS change does not show up are a missing widget ID, a missing semicolon, or your Shopify theme overriding your styling. Work through the checks in the Testing Your CSS Changes section above, and confirm you are looking at your live storefront rather than the widget editor's preview.
Does CSS added in a widget's Styles tab only affect that widget?
No, CSS added in a widget's Styles tab is not confined to that widget. The box controls which pages your CSS loads on, which is every page where that widget renders, but the CSS inside applies to the whole page just like any other stylesheet. Scope each selector with #rebuy-widget-XXXXX so it only changes that widget.
Do I need to replace XXXXX or 12345 in every CSS snippet?
Yes, every snippet containing #rebuy-widget-XXXXX or #rebuy-widget-12345 needs XXXXX and 12345 replaced with your widget's actual ID number, or your CSS will not apply to anything. You can find the ID in the widget editor's top bar, or in the ID column of the Widgets list.
How do I apply one CSS change to all of my Rebuy widgets at once?
To style every widget at once, add your CSS to the Custom CSS box in your Rebuy Theme under Settings > Themes, and target .rebuy-widget instead of a specific widget ID. See the How to Add CSS to Every Widget at Once section above.
Can I style Post-Purchase or Checkout Extension widgets with CSS?
No, Post-Purchase and Checkout Extension widgets cannot be styled with custom CSS, because both run inside Shopify's sandboxed checkout environment, which does not allow custom CSS or JavaScript. Set their appearance through your Shopify Checkout branding settings instead, as described in the Which Rebuy Widgets Support Custom CSS section above.
Do I need to add Rebuy CSS to my Shopify theme files?
No, you never need to add Rebuy widget CSS to your Shopify theme files, because Rebuy loads your custom CSS itself. Add it in your Rebuy Theme for store-wide styling, or in an individual widget's Styles tab for one widget.
Will custom CSS in Rebuy affect the rest of my store?
Custom CSS added in Rebuy can affect the rest of the page, because Rebuy loads it as an ordinary stylesheet rather than confining it to the widget. It never edits your Shopify theme files, so nothing about your theme is permanently changed, but an unscoped selector such as h2 { } or .button { } restyles every matching element on the pages where your CSS loads. Scope every selector with #rebuy-widget-XXXXX for a single widget, or .rebuy-widget for all widgets, to prevent that.
How do I find the class name of the widget element I want to style?
To find any element's class name, right-click it on your live storefront, choose Inspect, and read the class name on the highlighted element in the developer tools panel. Use that class name as your selector, scoped to your widget ID.
Can I use different styling on mobile than on desktop?
Yes, you can target mobile screens only by wrapping your CSS in a media query such as @media only screen and (max-width: 480px), which applies your styling at or below the screen width you set and leaves desktop screens unaffected.
Can I use ChatGPT or Claude to write Rebuy CSS?
Yes, you can use an AI assistant for Rebuy CSS, and Rebuy publishes its developer documentation in machine-readable files built for exactly that. Point your tool at https://developers.rebuyengine.com/llms.txt for an index of the documentation, or https://developers.rebuyengine.com/llms-full.txt for the complete contents, then confirm any class name it gives you with Inspect on your live storefront. See the Using AI Tools with Rebuy's Developer Documentation section above.
Does Rebuy support troubleshooting custom CSS?
Rebuy's support team can point you to the correct guides, but does not troubleshoot, write, or debug custom CSS, because custom code falls outside the standard Rebuy package. For custom styling work, see the Rebuy Partner Directory and Rebuy's support policy.
*Please Note
Rebuy support services encompass all aspects directly associated with Rebuy, providing assistance and guidance for features and functionalities within the standard Rebuy package. However, please note that we cannot provide support for third-party plugins or customizations beyond the scope of Rebuy. Unsupported items include, but are not limited to, custom template modifications/troubleshooting, headless configurations/troubleshooting, native cart configurations/troubleshooting, Custom CSS/Javascript, custom scripts, and third-party integrations.
Please refer to our policy page Please be mindful of this when proceeding.






