Theme
đź’Ž Built for Sidekick
✍️ Sidekick drafts it — you apply it
shopify
sidekick
theme
product-page
javascript
Generate Recently Viewed Products
Build a recently viewed products section using localStorage to track and display products the customer has browsed.
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
Create a “Recently Viewed Products” section for my Shopify theme: Features: Track viewed products using localStorage Display as a horizontal scrollable carousel Show product image, title, price, and compare-at price Quick add-to-cart button on hover Maximum of 10 recently viewed products stored Settings: Section heading text Number of products to display (4-8) Show/hide prices toggle Show/hide add-to-cart button toggle Background color Card style (bordered, shadow, minimal) Requirements: Works without any app — pure JavaScript + localStorage Responsive grid on mobile (2 columns) Exclude current product from the list Handle product unavailability gracefully Generate the Liquid, CSS, and JavaScript for this as a custom theme section I can paste into my own theme. Where to add it: In the Shopify admin, go to Online Store > Themes > Edit code, create a new file under Sections (e.g. sections/recently-viewed-products.liquid), paste the generated code in, and save. Then open the theme editor, go to the template where you want it to appear (usually the product page), and use “Add section” to place it.
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