Restyle the Depict Recommendations section with custom CSS: its classes, data attributes and CSS variables, where to put your CSS, and copy-paste examples.
The section settings cover
items per row, card spacing, arrows, color scheme, card and hover images, and
the heading. For anything beyond those, the Depict Recommendations section
exposes stable classes, data attributes and CSS variables you can target from
custom CSS.
Try the section settings first: they need no CSS, and you see the result
in the theme editor as you change them.
section.depict-rec-section ← the whole carousel└─ div.depict-rec-section__inner ← width-limited column ├─ h2.depict-rec-section__heading ← only when a heading is set └─ div.depict-recs__viewport ← positions the arrows ├─ button.depict-recs__nav-btn.depict-recs__nav-btn--prev │ └─ span.depict-recs__nav-icon ├─ div.depict-recs__grid ← the scrolling row │ └─ div.depict-recs__item ← one per product, wraps a product card └─ button.depict-recs__nav-btn.depict-recs__nav-btn--next
The product cards are your theme’s own cards. Depict renders each product
with your theme’s product card, so cards match the rest of your store. That
means the card’s title, price, image and hover image carry your theme’s class
names, not Depict’s. See Styling the product cards.When your theme’s card can’t be used, the section shows a simple card of its
own instead (.depict-recs__card, listed below).
Set these on .depict-rec-section, using the
selector prefix:
Variable
Default
Description
--depict-max-width
Your theme’s page width
Maximum width of the content column. 100% drops the page-width cap (your theme’s side margins still apply); a value such as 1200px narrows it.
--depict-side
1rem
Side inset of the content column, used when your theme sets no page margin of its own.
The section settings write the following variables directly on the element.
Change the setting rather than the variable; overriding one from CSS needs
!important.
Variable
Setting
--depict-items-desktop
Items per row (desktop)
--depict-items-mobile
Items per row (mobile)
--depict-card-gap
Space between cards
--depict-heading-size
Heading size
Any other --depict-* variable is internal and may change.
In the theme editor, select the Depict Recommendations section. In
themes that support it, a Custom CSS field sits at the bottom of the
section’s settings. Rules here apply to that one section only, and Shopify
scopes them to the section, which already outranks Depict’s defaults.
In the theme editor, open Theme settings (the gear icon) and expand
Custom CSS. Rules here apply across your whole store, so every
recommendations carousel picks them up.
In Shopify admin go to Online Store → Themes, click ⋯ → Edit code
on your theme, and add your rules to its main stylesheet (for example
assets/base.css). Updating your theme to a new version replaces its
files, so keep a copy of your rules.Shopify limits the length of both Custom CSS fields and doesn’t allow some
rules, such as @import. @media queries work.
Don’t edit sections/depict-recommendations.liquid in your theme’s code.
Depict replaces that file when it updates the section, and your changes are
lost. The same goes for snippets/depict-rec-item.liquid and the files
Personalized surfaces
use: sections/depict-rec-card.liquid and the product.depict-rec-card,
product.depict-rec-card-all and collection.depict-rec-fallback
templates. Don’t delete them either.
Sections showing a Personalized surface use the same markup, so the same CSS
applies to them.
Depict’s own rules mostly use single-class selectors and can load after your
theme’s CSS, so a rule with the same single class can lose to them. Start your
selectors with this prefix:
Because the cards are your theme’s own, find their class names with your
browser’s Inspect tool: right-click a recommended product’s title, price or
image and note its classes. Then scope those classes to the section, so the
change doesn’t reach the rest of your store:
/* Your theme's card, but only inside Depict recommendations. */.depict-rec-section[data-depict-recommendations-section] .your-card-title-class { /* … */}
The examples below use the class names of Dawn and Dawn-based themes
(.card__heading, .price, .media--hover-effect); swap in your theme’s
classes where they differ. If your store shows the simple card, use
.depict-recs__title, .depict-recs__price and .depict-recs__media.
Prefer the Items per row settings. To show a fraction of the next card, a
hint that the row scrolls:
/* 4.5 cards on desktop, 1.5 on mobile. */.depict-rec-section[data-depict-recommendations-section] { --depict-items-desktop: 4.5 !important; --depict-items-mobile: 1.5 !important;}
To lay all cards out as a wrapping grid instead of a scrolling row, let the
row wrap and drop the arrows. Each line holds the Items per row count; set
Max products to show to a multiple of it so the last line is full.
/* No page-width cap, and more space above and below. */.depict-rec-section[data-depict-recommendations-section] { --depict-max-width: 100%; padding-block: 4rem;}
.depict-rec-section[data-depict-recommendations-section] .depict-recs__title { font-weight: 600; -webkit-line-clamp: 1; /* one line instead of two */}.depict-rec-section[data-depict-recommendations-section] .depict-recs__price { opacity: 1; font-weight: 700;}
To change which image shows on hover, use the Hover image setting. To turn
the hover image off, untick Show secondary image on hover, or switch it off
in your theme’s own product card settings where the section doesn’t offer it.If neither is available, Dawn and Dawn-based themes can switch it off for
recommendations only:
/* Keep the first image on hover; never show the second. */.depict-rec-section[data-depict-recommendations-section] .media--hover-effect > img + img { display: none;}.depict-rec-section[data-depict-recommendations-section] .media--hover-effect > img:first-child { opacity: 1 !important;}
/* Hide the heading of the cart carousel only. */.depict-rec-section[data-depict-recommendations-section][data-depict-surface="cart"] .depict-rec-section__heading { display: none;}/* Hide prices in recommendations (Dawn and Dawn-based themes). */.depict-rec-section[data-depict-recommendations-section] .price { display: none;}/* Show only the first 4 products on mobile. */@media (max-width: 749px) { .depict-rec-section[data-depict-recommendations-section] .depict-recs__item:nth-child(n + 5) { display: none; }}/* Hide the whole carousel on the home page. */.depict-rec-section[data-depict-recommendations-section][data-depict-page="index"] { display: none !important;}
To remove a carousel for good, remove the section in the theme editor instead.
The section switches to its mobile layout at 749px wide and below: the
mobile items-per-row, a smaller heading and tighter edges. Any touch screen is
swipe-only, with no arrows. Use the same breakpoint so your rules switch
together with the section’s: