Skip to content
SleekSite AI Docs
On this page

Store templates

Wire the SleekSite Store into your templates: the storefront, shop regions, product data in views, product fields, store views and product templates.

Site Admins

The SleekSite Store keeps products, prices, stock and orders outside your site's content. Your templates place regions where the store renders live, so a price or stock change shows without a rebuild. This page covers the wiring. Business owners can ask the AI Assistant to do all of it.

live, in the browserat buildStore: products, prices,stockRegions: grid, product, cart,checkoutTemplates: getProducts,product fieldsYour pages

ImportantNever model products as content (a products+ collection, hard-coded prices or "in stock" text). Prices and stock come from the store, and a copy in your content goes stale the moment they change.

Mounting the store#

Turn the store on in Manage Site → E-Commerce first. Then call storefront() once, in your layout's <body>:

<%- storefront() %>

That loads the store runtime, the cart drawer and checkout. Add a cart button, and a sign-in link if customer accounts are on:

<a href="/shop" data-store-open>Cart <span data-store-count></span></a>
<a href="#" data-store-signin>Sign in</a>

data-store-count fills in with the number of items, and data-store-signin reads Account once the shopper is signed in.

Shop pages#

Each store page is an ordinary page whose view places one region:

Page Markup Renders
/shop <div data-store-grid></div> Every active product as a card, with category pills, 24 at a time with Show more
/product <div data-store-product></div> The product at /product/<handle>, rendered on the server for search engines (?p=<handle> also works)
/checkout <div data-store-checkout></div> Contact, delivery, shipping, discount code, Stripe card fields and Pay
/order/complete <div data-store-order></div> The confirmation: outcome, summary, fulfillment and tracking

Give /shop a heading and intro. Leave the product and confirmation pages to the region alone: they render their own titles and outcome.

Grid options:

<!-- a featured strip: exactly 4, no category pills, no Show more -->
<div data-store-grid data-limit="4" data-pills="0"></div>

<!-- one category -->
<div data-store-grid data-category="Bags"></div>

<!-- one product on any page, e.g. a Donate page -->
<div data-store-product data-handle="donate"></div>

storefront() options, only when your pages live at other addresses: productUrl (like '/item/{handle}'), checkoutUrl, completeUrl, shopUrl, title and float. A donation store can also pass continueLabel (the "Continue shopping" links) and thanks, the paid-order heading with {name} and {order} filled in.

Products in your templates#

Templates can read the store's active products as of the last build, for SEO-visible copy like a featured section. They carry no prices or stock: anything with a price or Add to cart should be a region.

Helper Returns
getProducts(filter?) Products in your order. filter: { category, handles, ids, q, limit }
getProduct(handleOrId) One product, or null
products All active products

Each product is { id, handle, title, description, category, media, options, attrs, content }. media[0] is the cover; img(p.media[0]) renders it.

<ul class="grid gap-6 md:grid-cols-3">
  <% getProducts({ category: 'Stoneware', limit: 3 }).forEach(function (p) { %>
    <li><a href="/product/<%= p.handle %>">
      <% if (p.media[0]) { %><%- img(p.media[0], { class: 'aspect-square w-full object-cover' }) %><% } %>
      <h3><%= p.title %></h3>
    </a></li>
  <% }) %>
</ul>

Product fields#

To let editors pick products for a page, add a product or [product] field to its model:

{
  featured_product: product,
  bestsellers: [product]
}

In content JSON the value is a product handle (or a list of handles). It's stored by id, so renaming a handle doesn't break it. In templates you get the product object, or null if it isn't active. Only sites with the store on can use these fields.

Product content blocks#

For richer product pages (specs, care instructions, FAQs), choose a content block for a product in Store → Products → Setup. Editors fill it in on the product's Content tab, and templates read it as p.content, rendered with render(p.content).

Store views#

The regions are drawn by your site's store views, in views/store/ in the Site Builder. They're added when the store is turned on, and you can edit them like any view:

File Draws
product.ejs Every product page
product.<template>.ejs Product pages for products with that Template
_card.ejs / _card.<template>.ejs A product card in the grid
grid.ejs, cart.ejs, checkout.ejs, order.ejs, account.ejs The grid, cart drawer, checkout, confirmation and account panel

Store views render in the shopper's browser with live prices and stock. The starting versions are read-only in store/defaults/: read one before writing your own, and delete your copy to reset it.

In a store view:

  • Data: a product view gets product, the chosen sku (with price_integer, compare_at_integer and availability: in_stock, low or sold_out), options, media and current, qty, buyable, amount (for open amounts), and loading / error. A card view gets card
  • Prices: always format with money(cents). It uses the currency the shopper pays in
  • Interactions are attributes, not JavaScript. <script> tags don't run in store views
Attribute Does
data-action="add" Adds the chosen variant to the cart
data-action="buy" Adds it and goes to checkout
data-action="option" data-option="Size" data-value="M" Chooses an option
data-action="media" data-value="2" Shows that image or video
data-action="qty" data-value="1" Changes the quantity (-1 to lower)
data-action="amount" data-value="2500" Picks a quick amount, in cents
<input data-field="amount"> The amount the shopper types

Add disabled to the add and buy buttons when !buyable.

Product templates#

Different kinds of products can have different pages, like coffee showing its origin and roast. Give those products a Template (in Setup) and their details as product attributes, then add views/store/product.<template>.ejs:

<% if (loading) { %>
  <span class="sks-ghost" style="height:12rem"></span>
<% } else if (error) { %>
  <p><%= error %></p>
<% } else { const a = product.attrs || {}; %>
  <p><%= a.origin %> · <%= a.roast %> roast</p>
  <h1><%= product.title %></h1>
  <p><%= money(sku.price_integer) %></p>
  <button type="button" data-action="add"<% if (!buyable) { %> disabled<% } %>>Add to cart</button>
<% } %>

The build checks store views like any view: a view that doesn't compile, uses <script>, writes prices by hand or leaves out checkout's payment fields shows as a build error.

Styling#

Match the store to your theme with CSS variables on :root, rather than restyling its markup:

:root {
  --sleek-store-accent: var(--color-brand-600);
  --sleek-store-on-accent: #fff;
  --sleek-store-text: var(--color-ink-900);
  --sleek-store-muted: var(--color-ink-600);
  --sleek-store-line: var(--color-line);
  --sleek-store-bg: #fff;
  --sleek-store-radius: 12px;
  --sleek-store-heading-font: var(--font-display);
}

To change the markup itself, edit the store view.

Was this page helpful?

Last updated November 18, 2026