Custom CSS and JavaScript
Restyle the Zupli drawer with CSS variables and class overrides, and add behaviour with JavaScript. With the full variable and class reference.
On this page
Zupli’s drawer is built to be restyled without touching theme files. Most changes need only CSS variables; class overrides and JavaScript cover the rest.
Where to add code
On the Appearance page, open Advanced settings. There are two editors:
- CSS overrides: plain CSS, added to the page’s
<head>as<style id="optimaio-custom-css">. Don’t wrap it in<style>tags. - JavaScript overrides: runs as a
<script id="optimaio-custom-js">added to the end of the page’s<body>. No<script>tags needed.
Changes show in the Cart Preview before they reach your store. Each cart template has its own Appearance, so an A/B variant can carry its own code.

How styles layer
- Zupli core styles: the defaults.
- Theme preset: the cart theme you chose.
- Your CSS overrides.
- The colours and z-index you set in the app, applied directly to the drawer’s elements.
Your overrides beat the core styles and the theme preset. To override a value you’ve also set in the app (the button, text and progress bar colours, the floating button colour, and the z-index), add !important, or clear it in the app.
CSS variables (start here)
Set variables on #optimaio-cart-drawer:
#optimaio-cart-drawer {
--bg-primary: #ffffff;
--border: #e6e6e6;
}
Backgrounds and surfaces
| Variable | Used for |
|---|---|
--bg-primary |
Main drawer background |
--bg-secondary |
Product cards, tabs, offer cards, inputs |
--bg-soft |
Subtle backgrounds such as badges and soft panels |
--border |
Item cards, tabs, progress container, quantity buttons, offer cards, inputs |
--overlay-bg |
The dimmed overlay behind the drawer |
--loader-bg, --loader-track |
The loading indicator |
Text
| Variable | Used for |
|---|---|
--text-primary |
Headings, product titles, prices. Also set by Text > Primary in the app. |
--text-secondary |
Secondary labels and descriptions. Also set by Text > Secondary. |
--text-muted |
Variant text, remove buttons, small labels |
--error-text |
Error messages |
--discount-text |
Discount labels, amounts and badge borders |
Accent
| Variable | Used for |
|---|---|
--accent |
Buttons, checkout, progress fill, active tabs. Also set by Button color in the app. |
--accent-inactive |
Soft highlight backgrounds |
--accent-contrast |
Text on accent backgrounds |
Progress bar
| Variable | Used for |
|---|---|
--progress-inactive |
The unreached part of the bar |
--progress-start, --progress-end |
The fill’s gradient |
--progress-icon-active-fill |
Reached milestone icon fill |
The gradient only shows when Progress Bar start and end colours are set in the app; otherwise the fill uses --accent.
Savings banner and stacking
| Variable | Used for |
|---|---|
--optimaio-savings-gradient |
The savings banner’s gradient |
--optimaio-z-index |
Stacking order of the drawer (10000 by default). Also set by Z-index in the app. |
The floating cart button
The floating button, #optimaio-zupli-cart, sits outside the drawer, so variables set on #optimaio-cart-drawer don’t reach it. Its colour comes from Widget color in the app; to restyle it in CSS, target it directly:
#optimaio-zupli-cart {
background: #111 !important;
color: #fff;
}
Ready-made looks
/* Dark cart */
#optimaio-cart-drawer {
--bg-primary: #111;
--bg-secondary: #1a1a1a;
--text-primary: #f5f5f5 !important;
--accent: #00e676 !important;
}
/* Minimal light cart */
#optimaio-cart-drawer {
--bg-primary: #fafafa;
--bg-secondary: #ffffff;
--border: #e5e5e5;
}
The !important on --text-primary and --accent is only needed if you’ve set those colours in the app too.
Class overrides (advanced)
When a variable doesn’t cover it, such as font size, spacing or radius, target the drawer’s classes:
| Selector | Element |
|---|---|
#optimaio-cart-drawer |
The drawer; .open while it’s open |
body.optimaio-cart-open |
The page while the drawer is open |
.optimaio-cart-drawer__header, __items, __footer, __summary, __empty |
The drawer’s main areas |
.optimaio-cart-item__title, .optimaio-cart-item__remove |
A cart item’s title and remove button |
.optimaio-checkout-btn |
The checkout button |
.optimaio-progress-bar, .optimaio-progress-fill |
The cart goal progress bar |
.optimaio-savings-banner |
The “You have saved” banner |
.optimaio-offer-card, .optimaio-tab-btn |
Offer cards, and the Cart and Offers tabs |
.optimaio-recommendation-card |
An upsell product card |
.optimaio-empty-upsell |
The empty cart upsell |
.optimaio-continue-btn |
The Continue Shopping link |
.optimaio-announcement-viewport, .optimaio-announcement-item |
The announcement bar and one message; .active is the one showing |
#optimaio-zupli-cart |
The floating cart button |
body[data-optimaio-theme] |
The chosen cart theme |
.optimaio-cart-item__title {
font-size: 16px;
font-weight: 600;
}
.optimaio-recommendation-card {
border-radius: 12px;
padding: 14px;
}
JavaScript
Use JavaScript overrides with the Cart JavaScript SDK: listen to open, close, checkoutAttempt and more, call openCart, closeCart or refreshCart, and replace checkout with overrideCheckout.
Best practices
- Use variables first, class overrides only when needed.
- Use
!importantonly for values you’ve also set in the app. - Keep rules that are already in the editor unless you know what they do.
- Test on mobile and desktop, and again after Zupli updates.
Was this page helpful?
Thanks for letting us know.
Sorry about that. Tell us what was missing and we'll fix the page.