A product whose sizes come in colors gets a Color drop-down. Only the chosen color's sizes show, a size already picked carries over, and the photos switch to that color's. The script ships with HotDog like the cart's, only when some page has colors; without it the page lists every color as before. The Fourthwall import marks each photo with the color it shows, and -photos now counts per color.
87 lines
3.5 KiB
YAML
87 lines
3.5 KiB
YAML
name: shop
|
|
version: 1.4.0
|
|
title: Shop
|
|
description: A product catalog with a page per product (photos, price, options), where Buy opens your payment provider's checkout, and an optional cart. No card details on your site.
|
|
license: MIT
|
|
author: Coffey Labs LLC
|
|
collections:
|
|
products:
|
|
layout: product
|
|
list_layout: shop
|
|
sort: weight
|
|
notes: |
|
|
Make a payment link for each product in your provider's dashboard (Stripe
|
|
Payment Links can ask for a quantity, a shipping address and sales tax),
|
|
then add each product as content/products/<name>.md:
|
|
|
|
---
|
|
title: Sourdough starter kit
|
|
summary: Our 20-year-old starter, a jar and the instructions.
|
|
price: 24
|
|
currency: USD
|
|
weight: 1
|
|
photos:
|
|
- { image: /media/shop/kit.jpg, alt: A jar of starter beside a recipe card }
|
|
buy: https://buy.stripe.com/your-link
|
|
options:
|
|
- { name: Kit and a proving basket, price: 39, buy: "https://buy.stripe.com/another-link" }
|
|
---
|
|
What's in the box, how it ships, and anything else, in Markdown.
|
|
|
|
The first photo shows large. With more than one, a row of small ones sits
|
|
under it, and picking one (a click, or the arrow keys) shows it large, with
|
|
no script. Up to 24 photos; the alt text names each one to a screen reader.
|
|
|
|
Sizes and colors: list them as variants, each with its own buy link and
|
|
price; a group (a color) gathers them under a heading, and sold_out: true
|
|
crosses one out. price_from: true shows "From" before the price.
|
|
|
|
variants:
|
|
- { group: Black, name: S, price: 24, buy: "https://buy.stripe.com/s" }
|
|
- { group: Black, name: XL, price: 26, buy: "https://buy.stripe.com/xl" }
|
|
|
|
With groups and a checkout form (below), a drop-down picks the group
|
|
(choose_group: names it; Color by default) and only its sizes show. Give
|
|
a photo the same group: and it shows only with that color. Without
|
|
JavaScript every group's sizes and photos are listed instead.
|
|
|
|
A provider whose checkout takes the choice in its address (Fourthwall's
|
|
does) gets a proper picker instead: give the product a checkout form and
|
|
each variant the value it sends, and Buy goes to the checkout with the
|
|
size or color chosen, still without a script.
|
|
|
|
checkout: { action: "https://shop.example.com/cart/checkout", field: products, fields: { currency: USD } }
|
|
|
|
hotdog-cms import fourthwall writes all of this from a Fourthwall shop.
|
|
|
|
A cart: when the checkout takes several things at once (item: "{id}:{qty}"
|
|
and join: "," in the checkout form, as Fourthwall's does), turn on
|
|
cart: true in site.yaml, put {{ cart }} in your theme's head and
|
|
{{ cartLink }} in its header, and add content/cart.md:
|
|
|
|
---
|
|
title: Your cart
|
|
layout: cart
|
|
suggest: 4
|
|
---
|
|
|
|
Products then have Add to cart beside Buy now. The cart is kept in the
|
|
visitor's browser, and its page suggests other products, those sharing a
|
|
tag with what's in the cart first. Without JavaScript, Buy now still
|
|
works.
|
|
|
|
Shelves: give a tag a page of its own, content/tags/<tag>.md, with
|
|
layout: shelf, and /tags/<tag>/ shows that tag's words and its products
|
|
in the shop's order. The "Products" section's tag field shows just one
|
|
tag's products on any page.
|
|
|
|
---
|
|
title: Kitchen
|
|
layout: shelf
|
|
---
|
|
Everything for baking, from starters to baskets.
|
|
|
|
sold_out: true shows Sold out instead of the buttons. weight sets the
|
|
order (lowest first). /products/ lists them; the "Products" section shows
|
|
some on any page. Mention your payment provider in your privacy notice.
|