Docs
Documentation

Custom code

Upload your own HTML, CSS and JavaScript and run it as your storefront. SellSpace keeps doing the products, cart and checkout.

Custom Code is a paid plugin: EUR 9.99 per month on every plan. Get it in Marketplace > Plugins > Custom Code, or from the Custom Code box on the Themes page of your dashboard. This page is public so you can read how it works before you buy.

How to start

  1. Open Themes in your dashboard and activate Custom Code for your shop (€9.99 per month, on every plan).
  2. Drop your site as a zip on the Custom code block. Each file is checked; errors are listed per file.
  3. Click Preview. It opens a private page with your real products. Buyers do not see it.
  4. Click Publish. Back to standard theme is always there if you change your mind.

If the plugin ends or a payment fails for good, your shop goes back to its standard theme and keeps selling. Your code stays stored and comes back when you activate the plugin again.

You can also pay for Custom Code with crypto (when SellSpace has it switched on): Pay 1 month with crypto in the Custom Code box. Crypto pays for 1 month. It does not renew. Pay again next month. When the month ends your shop shows its standard theme again and your code stays stored. See Paying for SellSpace plugins with crypto.

Zip layout

site.zip
  index.html      required: home page
  products.html   optional: all products, category and group pages
  product.html    optional: one product
  style.css
  app.js
  images/logo.png
  fonts/site.woff2

A zip of a single folder works too. Without products.html or product.html, those pages open index.html and you read SellSpace.route to know what to show.

LimitValue
Zip size20 MB
Unpacked60 MB, 15 MB per file
Files400
Allowed typeshtml, htm, css, js, mjs, json, txt, png, jpg, jpeg, gif, webp, avif, ico, svg, woff, woff2, ttf, otf
NamesLetters, digits, spaces and . _ - ( ) @ + ~. No hidden files, symlinks or zips inside the zip.

Starter template

Do not start from a blank page. The starter template is a complete, good-looking site (dark theme, blue accent, works on phones) that already uses every SellSpace function, so nothing gets forgotten. Download it from the Custom Code box on the Themes page once the plugin is active (Download starter template, a file called sellspace-custom-code-starter.zip). This page only explains it: the download is for shops with the active plugin.

FileWhat it is
index.htmlHome: hero, featured products, categories, reviews, payment methods, social links.
products.htmlAll products, category pages and group pages, with category filter and sorting.
product.htmlOne product: gallery, option buttons on top of the data-ss-variants select, quantity buttons, price, Add to cart, Buy now, stock, reviews of that product.
help.htmlCart, checkout, account, support and legal pages in one place.
style.css, app.js, images/, README.txtColors in variables at the top, shared header and footer plus commented SellSpace hooks, placeholder logo and product image, and a short guide.

How to use it: unzip, change colors in style.css and texts in the html files, zip the contents again, drop the zip on the Custom Code box, click Preview, then Publish.

Checklist, did you add all of these?

A small working example

Save this as index.html, zip it, upload it. It lists your products and sells them.

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>My shop</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <header>
    <h1 data-ss-shop="name"></h1>
    <button data-ss-cart>Cart (<span data-ss-cart-count>0</span>)</button>
  </header>
  <main data-ss-products>
    <template>
      <article>
        <img data-ss-field="image" alt="">
        <h2 data-ss-field="name"></h2>
        <p data-ss-field="price"></p>
        <button data-ss-add>Add to cart</button>
      </article>
    </template>
  </main>
  <button data-ss-checkout>Checkout</button>
</body>
</html>

Data attributes

The SDK is added to every HTML file for you. These attributes are filled in when the shop data arrives. A container with a <template> gets one copy per item; without one it gets a plain default.

AttributeWhat it does
data-ss-productsLists products. Optional: data-ss-category="slug", data-ss-limit="8". Follows the category or group page by itself.
data-ss-productOne product block. Empty: the product of this page. Or a product id or slug.
data-ss-fieldInside a product: name, price, description, image, category, stock.
data-ss-add="12"Add to cart. Empty inside a product block: that product. Optional data-ss-qty, data-ss-variant.
data-ss-buy="12"Buy now: goes straight to checkout with this item.
<select data-ss-variants>Options of the product (one <option> per variant, the variant id as value). Add and Buy use the chosen one of the select in the same product block, wherever your buttons sit inside it. The price in data-ss-field="price" follows the choice. The select works hidden too (display:none or clipped): to build your own buttons or pills, set select.value to the variant's value and dispatch a change event. A product with several options needs one chosen, or Add and Buy show "Choose an option first".
<a href="https://...">A normal link to another site (YouTube, TikTok, X, Discord, Instagram, GitHub ...). It opens in a new tab, whatever target says, and only after a click by the buyer. Only https:// addresses with a normal public name work: no http://, IP addresses, localhost, user:password in the address or custom ports. Links between your own files, data-ss-nav and the other attributes keep working as before.
<input data-ss-quantity>Quantity for Add and Buy in the same block. Set its value from your own + and - buttons: typing does not reach it.
data-ss-linkInside a product: opens that product's page.
data-ss-cartOpens the cart. data-ss-cart-count shows the number of items.
data-ss-checkoutOpens the SellSpace checkout.
data-ss-nav="products"Goes to home, products, cart, checkout, account, support, or with data-ss-ref: product, category, group, legal.
data-ss-shopname, description or logo of the shop.
data-ss-categoriesLists categories (data-ss-field="name", "image").
data-ss-payment-methodsLists the shop's payment methods by name and icon.
data-ss-reviewsLists reviews (data-ss-field="rating", "message", "name").

A site without any of these hooks and without the SDK cannot sell. The upload warns you and you can still publish it.

The SDK

SellSpace.ready(function () {
  document.title = SellSpace.shop.name;
  SellSpace.on('cart', function (items) { console.log(items.length + ' lines in the cart'); });
  var first = SellSpace.products()[0];
  if (first) document.querySelector('#add').onclick = function () { SellSpace.cart.add(first.id, { qty: 1 }); };
});
CallResult
SellSpace.ready(fn)Runs fn when the shop data is there.
SellSpace.shop, .route, .previewName, description, currency, logo, colours; this page; whether this is a preview.
.products(), .product(idOrSlug)Public products: name, price, images, variants, stock.
.categories(), .groups(), .paymentMethods(), .legal()Public lists.
.reviews({ product_id })Promise of a summary and reviews.
.cart.get(), .add(id, { variant, qty }), .remove(id, { variant }), .setQty(id, qty, { variant }), .open()The cart. The SellSpace page does the work and shows the notice.
.checkout.start([id, { variant, qty }])Opens the SellSpace checkout. Needs a click by the buyer.
.navigate(page, ref)Same pages as data-ss-nav. Needs a click by the buyer.
.on('cart', fn), .money(n)Cart changes; a price in the shop's currency.

What your code cannot do

Your site runs in a locked frame on a separate domain, around which SellSpace shows the page. That keeps buyers and you safe, and it means:

SellSpace keeps a small bar under your site with the cart and Report this shop. Search engines get your shop name, descriptions and product list as plain text from SellSpace.