Theme
đź’Ž Built for Sidekick
✍️ Sidekick drafts it — you apply it
shopify
sidekick
theme
personalization
Recently Viewed Products Row
Display a row of recently viewed products using browser local storage for personalization.
Sidekick writes it — you put it live
Sidekick produces the content or code for this, but doesn't apply it to your store itself. You'll paste or publish the result yourself — the prompt tells Sidekick to explain exactly where it goes.
đź“‹ Prompt
Generate the Liquid section, JavaScript, and CSS for a recently viewed products section that I can paste into my theme, with these specifications: it should track which products a customer has viewed using browser localStorage and display them in a horizontal scrollable row. Show up to [MAX_PRODUCTS] products (e.g., 8). Each product card should display: product image, title, price, and a Quick Add button. The section should only appear if the customer has viewed at least [MIN_PRODUCTS] products (e.g., 2). On each product page load, save the product handle, title, image URL, price, and URL to localStorage. Use the section heading [SECTION_HEADING] (e.g., Recently Viewed). The row should scroll horizontally with arrow buttons on desktop and swipe on mobile. Include a Clear History link. Do not use cookies – localStorage only. Generate the Liquid section, JavaScript, and CSS. To use it: go to Online Store > Themes > Edit code, create sections/recently-viewed-products.liquid and paste in the generated code (JS/CSS can go in assets/ and be linked from the section or theme.liquid), then use the theme customizer to add the “Recently Viewed” section to your homepage, collection, or product templates. Make sure the tracking script is included on your product page template so views get saved as customers browse.
How to Use
- Copy the prompt above
- Open Shopify Sidekick in your Shopify admin
- Paste the prompt and replace the bracketed placeholders with your details
- Review Sidekick's response and apply the suggestions