Where products come from
getStore()returns every listable product instore.products- use it for grids, search, categories and the cart. See Store Information.getProduct(idOrSlug)fetches one product, by ID or slug - use it for a product page.getProductReviews(productId, page)fetches a product’s reviews, a page at a time.
Get one product
store.products instead.
The product object
Prices
Sort variants byorder and format cost with the store’s formatter:
cost to the formatter exactly as it arrives. On a store with adaptive currency the
formatter converts it into the shopper’s currency - see Currency formatting.
Stock
Three fields decide what to show:Restock signups
If the merchant has restock emails on,store.isRestockSignupEnabled is
true. Keep a sold-out variant’s button active and open the built-in dialog, which asks for the
buyer’s email, solves the captcha and shows the result:
komerza.signUpForRestock(variantId, emailAddress) from the
submit handler. It solves the captcha on the way and resolves to an ApiResponse, so check success
and show invalidFields or message on failure. Your form has to tell the buyer what they’re signing
up for, because submitting it is their consent.
Quantity limits
A variant can set a minimum and a maximum quantity per order (maximumQuantity is -1 when there’s
none). The cart doesn’t enforce them - checkout does, and
refuses an order outside them - so clamp your quantity input:
Subscriptions
A subscription variant hastype: 1 and a billingInterval:
buyNow(), which empties the cart first, or tell the
buyer before they add one.
Volume pricing
volumeDiscounts holds quantity tiers. The highest tier the quantity reaches applies to every unit:
disableVolumeDiscountOnCoupon is true, the tiers stop applying.
Custom fields and Discord
customFields are the questions a merchant asks at checkout, and requireDiscordAuthorization means
the buyer has to link their Discord account. Komerza’s hosted checkout handles both, so there’s nothing
for your storefront to collect. Read them only if you want to tell the buyer what’s coming.
Badges
badges are the labels a merchant pins on a product, such as “New” or “Sale”, each with an optional
hex color. isBestSeller marks the product the merchant chose as their best seller.
Images
imageNames holds file names, not URLs. A variant with no images of its own uses the product’s:
Reviews
Complete example
A product page atproduct.html?slug=...:
Next
Currency Formatting
Prices in the store’s currency, or the shopper’s
Basket
Adding to the cart, and rendering it