formatPrice, productSavings) are truly synchronous.
Customer
getCustomer()
Returns the full current customer object from the session (same as the customer global).
getUser()
Returns a lightweight { name, email } object for the current session customer.
Orders
getOrders(sortBy?, limit?)
Fetch the current customer’s orders from the database.
| Parameter | Type | Default | Description |
|---|---|---|---|
sortBy | string | 'newest' | 'newest' or 'oldest' |
limit | number | 50 | Max orders to return (max 1000) |
Conversions
getConversions(email)
Look up conversions (purchases) by email address.
public_order_id, created_at, customer_email, product_name, total, currency_code, status.
Products
getProduct(code)
Fetch a single product by its product code.
getProducts(filters?)
Fetch products with optional filters.
| Filter | Type | Description |
|---|---|---|
type | string | 'physical', 'digital', or 'any' |
classification | string | 'subscription', 'one-time', or 'any' |
codes | string | Comma-separated product codes |
getAllProducts()
Fetch all products for the brand (no filtering).
getProductByCode(merchantCode, productCode)
Look up a product by merchant gateway code and the merchant-specific product code.
productSavings(product)
Compute savings info from a product’s price and retail_price. Returns an object:
{ amount: 0, percent: 0, amountFormatted: '', percentFormatted: '' } when there is no discount.
subscriptionSummary(product)
Returns a human-readable subscription description string.
formatPrice(value, currency?)
Format a numeric price with the given currency code.
Courses
getCourse(courseId)
Fetch a course by ID, including modules and contents.
getCourseBySlug(slug)
Fetch a course by its URL slug.
getModuleBySlug(courseSlug, moduleSlug)
Fetch a single module with its contents.
getCourses()
Fetch all courses for the brand with lesson and module counts.
getCoursesByCategorySlug(categorySlug)
Filter courses by category slug.
getCategoriesWithCourses()
Get all course categories with their courses grouped together.
Blog
getBlog(blogId?)
Fetch a blog by ID. If no ID is provided, returns the default blog for the current domain.
getBlogArticles(blogId, page?, perPage?)
Fetch published blog articles with pagination.
| Parameter | Type | Default | Description |
|---|---|---|---|
blogId | number | — | Blog ID (required) |
page | number | 1 | Page number |
perPage | number | 12 | Articles per page (max 100) |
body field with the article content.
getBlogArticle(blogId, slug)
Fetch a single published article by blog ID and slug.
getBlogCategories(blogId)
Get category summaries for a blog’s published articles.
getRelatedArticles(blogId, articleId, limit?)
Fetch related articles for a given article.
| Parameter | Type | Default | Description |
|---|---|---|---|
blogId | number | — | Blog ID |
articleId | number | — | Article to find related content for |
limit | number | 4 | Max related articles (1–24) |
Purchase Links
These functions generate URLs for the payment flow. They are synchronous.buy(productCode)
Generate a purchase link for a product.
upsell(productCode)
Generate an upsell link (one-click purchase for existing customers).
downsell(productCode)
Generate a downsell link (same mechanics as upsell).
decline(productCode)
Generate a decline link (skip the upsell offer and proceed).
Assets
asset(path)
Generate a full CDN URL for a brand asset.
?nc, ?no_cache, or ?preview_key is present in the request.
Visitor Control
whitelistVisitor()
Whitelist the current visitor by setting an encrypted cookie. Whitelisted visitors bypass access restrictions.
blacklistVisitor()
Blacklist the current visitor by setting an encrypted cookie.
Session Items
These functions read and write custom session items that are compatible with the template engine’ssetSessionItem / getSessionItem functions. Values are stored with a custom_ prefix and base64-encoded.
Use these when you need to share data between backend scripts and template-engine expressions on the same page or across pages within the same session.
setSessionItem(key, value)
Store a custom value in the session. Keys are sanitized to [a-zA-Z0-9_]. Values over 64KB are silently dropped. Pass null to delete.
getSessionItem(key)
Retrieve a custom session item. Returns an empty string if not found.
clearSessionItem(key)
Remove a custom session item.
For raw session access (without the
custom_ prefix and base64 encoding), use session.get(key) and session.set(key, value) from the Actions page.