Open the widget editor
Go to Personalization → Recommendation widgets, find the widget you want to edit, and click Modify → Edit. The editor exposes the markup and styles for the widget.The two templates
Widget styling is built from two templates:- Product card template — the markup for a single product card. This is what’s repeated for each recommended product.
- Widget template — the container that wraps all the cards, including the header, navigation arrows, and pagination dots.
Product card HTML
The card template is HTML with template variables that pull product data from the algorithm. The most commonly used variables:
A minimal product card might look like this:
Conditional rendering
Use conditional blocks to show or hide elements based on product data. For example, show the discount badge only when an old price exists:Widget container HTML
The widget template wraps the repeated cards. It typically includes:- A header (
<h2>or similar). - The slider wrapper.
- Navigation arrows (previous/next).
- Pagination dots.
CSS guidelines
Scope all selectors
Always prefix CSS rules with#popmechanic-form so that widget styles don’t bleed into the rest of your site — and vice versa.
Use flexbox for the slide row
Applydisplay: flex to the slide container so cards line up horizontally:
Use padding for spacing, not margin
Spacing between slides should be set withpadding on each slide, not margin. Margins interact poorly with the slider’s transform calculations and cause cards to jump.
Smooth the slider transition
Add atransition on the slider track for smooth carousel movement:
Navigation arrows
Arrows are generated automatically. Style them by targeting the arrow elements and replacing the default icon with a base64-encoded SVG background:url(...). This keeps the arrow self-contained, so no external image request is needed.
Responsive configuration
Set the number of visible cards and the spacing for each breakpoint in the widget’s Display settings. Typical setup:
You can also configure a minimum slide threshold — if the algorithm returns fewer products than the threshold, the widget hides itself instead of rendering an awkwardly empty row.
Autoplay
Enable autoplay by passing custom parameters to the underlying tiny-slider (TNS) instance. In the widget’s Additional parameters, add:autoplayTimeout— milliseconds between slide changes.autoplayHoverPause— pauses when the customer hovers a card.autoplayButtonOutput— set tofalseto hide the default stop/start button.
Test your styling
The editor includes a live preview, but always also open the Test link to see the widget render on your real site with your real product data. Pay attention to:- How cards align next to existing site elements.
- Whether your global CSS is leaking into the widget (look for unexpected fonts, colors, or margins).
- Mobile behavior — open the test link on a phone or use device emulation.
Next steps
- How to Create a Recommendation Widget — full setup walkthrough.
- Product Grouping in a Recommendation Widget — add category tabs inside the widget.