liteshop.catalogue.list(), so that new items appear on the Site without a
rebuild.
Declare the catalogue
Addcapabilities.catalogue with the items Visitors can request and the
contact fields every request collects. Item IDs are stable lowercase kebab
case. kind is product or service. maximumQuantity (1 to 100) is the
largest quantity a Visitor may request at once and defaults to 1. Optional
description (up to 2,000 characters per language), price (an integer
amount in minor units, such as cents, and an ISO 4217 currency) and
images (up to 8 PNG, JPEG, WebP or AVIF files in the bundle, main image
first) are shown by the Site; the price is display only. A single image path
is also accepted, but not together with images. Optional collections group
items under a name, in order. Owners can also add and remove an item’s images
on the Catalogue page, which stores the files under assets/ and publishes
the change, so render images from the listed item rather than fixed paths.
requestFields use the same field types and limits as Forms.
Removing or renaming an item later is allowed: existing requests keep the item
as it was when they were sent, and new requests for a removed item are refused.
Show the catalogue
liteshop.catalogue.list() returns the published items and collections. Each
item has id, kind, name and optional description (objects keyed by
language), optional price, optional images (Site-relative URLs, main image first)
and image (the main one),
maximumQuantity and available. available is false when the Owner
tracks stock and none is left: show the item as sold out and don’t offer a
request.
textContent, never innerHTML. Prefer rendering from the list
over hard-coding items in HTML: an item the Owner removes in the dashboard
can’t be removed while a page names it in a literal catalogue.request.
Send a request from the Site
Load the same-origin SDK and callliteshop.catalogue.request with the
itemId of a declared item, from the list or written literally:
contact keys are accepted; omit optional fields rather than
sending empty values. quantity is optional and must be a whole number from 1
to the item’s maximumQuantity. message is optional, up to 2,000
characters. The SDK reads the request language from <html lang="…">.
Errors use the stable codes CATALOGUE_QUANTITY_INVALID,
CATALOGUE_MESSAGE_TOO_LONG, CATALOGUE_OUT_OF_STOCK (not enough tracked
stock is left), the contact field codes used by Forms,
CAPABILITY_NOT_DECLARED and RATE_LIMITED (five requests per IP and item per
ten minutes, 100 per Site per hour). French pages receive French messages.
Draft previews disable network requests. Test a real request only after
Publish on the live Site.