Shoporama Templates
Below you will find information on how to develop a Shoporama theme.
Navigation
Overview
Generally speaking, a Shoporama theme consists of a series of HTML files located in a folder on our FTP server. The template language used in the individual files is Smarty, as mentioned below.
In each template you have access to a number of objects and methods. You can read more about them in our Template API.
Contact us at support@shoporama.dk if you have any questions.
Development environment
To make developing Shoporama themes easier and faster, we have built Hackorama - a local development environment that simulates the Shoporama production environment.
Hackorama lets you develop and test your themes locally without deploying to production. This gives you faster feedback and a more efficient development process.
Features
- Local API data fetching with a caching system
- Smarty 4 template engine with the same delimiters as Shoporama
- Wrapper classes that mimic the Shoporama "Safe*" classes
- Automatic image resizing and caching
- Simulated customer login and checkout flow
- Debugging tools and logging
Get started
Follow these steps to get started with Hackorama:
# 1. Klon repository
git clone https://github.com/blinksbjerg/hackorama.git
cd hackorama
# 2. Konfigurer din API-nøgle i setup.php
# Rediger setup.php og indsæt din Shoporama API-nøgle
# 3. Start lokal PHP server
php -S localhost:8080
# 4. Åbn din browser
# Naviger til http://localhost:8080
Example: Testing the product view
Here is an example of how you can test your product view in Hackorama:
# I din template fil (f.eks. product.html)
<div class="product-detail">
<h1><{$product->getName()|escape}></h1>
<div class="price">
<{$product->getPrice()|currency}>
</div>
<div class="description">
<{$product->getDescription()}>
</div>
</div>
# Test i Hackorama ved at navigere til:
# http://localhost:8080/product?id=123
Tip: Hackorama includes the Alaska2 theme as an example. You can use it as a starting point for your own theme or as a reference for best practices.
Note: Hackorama is not a 1:1 copy of the Shoporama production environment. It supports the basic functions needed for local theme development, but not all advanced features are implemented. It is designed to give you a fast and efficient development environment for the most common use cases.
Read more about Hackorama and see the full documentation on GitHub.
Smarty
The engine behind our template system is based on Smarty.
For backward compatibility reasons, we have version 2.6 installed, but we no longer maintain it, and we recommend that everyone use version 4.x. You can set the version in the store settings.
Note that this documentation only covers version 4.x.
The difference between standard Smarty and ours is that we use <{ and }> as delimiters. In other words,
the syntax is:
<h1>Velkommen til <{$webshop->getName()|escape}></h1>
Tips
Inspect content
If you're unsure what a variable is,
or what a function returns, you can run it through var_dump. If you have an
object, you'll always be able to see which methods are available in our Template API.
You use var_dump like this:
<{$order|var_dump}>
Check objects
In some cases, it is important to ensure that if you use a variable as an object, it is also
an object. Otherwise, the template will not work. We provide some global variables, such as $product,
$webshop, and others. For these variables, it is not necessary. You can check in one of the following ways:
<{* Typisk tilstrækkelig *}>
<{if $profile}>
<{$profile->getName()}>
<{/if}>
<{* Lidt grundigere *}>
<{if is_object($profile)}>
<{$profile->getName()}>
<{/if}>
<{* Meget grundig *}>
<{if is_a($profile, "SafeProfile")}>
<{$profile->getName()}>
<{/if}>
Debug
If you want to see which variables are available on the page you're developing, you can set Smarty to debug mode and view the variables in a new window. Insert the following code into your template:
<{debug}>
Read more about Smarty 4 here: Smarty 4 Documentation.
Available functions and modifiers
In Shoporama, you have access to a selected set of Smarty modifiers and functions that have been approved for security reasons:
Modifiers
String manipulation
|strip_tags - Removes HTML tags|substr:start:length - Extracts part of a string|trim - Removes whitespace|ucfirst - Capitalizes the first letterArrays and numbers
|implode:"," - Joins an array into a string|explode:"," - Splits a string into an array|count - Counts elements|floor - Rounds down|strlen - String lengthDate and other
|strtotime - Converts a date to a timestamp|md5 - MD5 hashFunctions in conditionals
Validation
isset($var) - Checks if a variable is setis_array($var) - Checks if it is an arrayis_object($var) - Checks if it is an objectintval($var) - Converts to an integerArrays and templates
in_array($needle, $haystack) - Searches an arraytemplate_exists('file.html') - Checks if a template existsExample:
<{if in_array($product->getProductId(), $featured_ids) && isset($show_badge)}>
Featured
<{/if}>
File structure
You'll receive FTP access to your store, and you'll need to place your theme in the root of your directory. The folder name is the name of the theme.
getMenu()You are generally free to name the files in /{navn}/templates as you like, with a few exceptions:
/{navn}/templates/global.html
The main page that contains the structure for the entire store. The actual content
is inserted where this template displays <{$contents}>, which is a
special variable that comes from index.html below. In other words, a very simple
global.html might look like this:
<!DOCTYPE html>
<html>
<head>
<title><{$webshop->getName()|escape}></title>
</head>
<body>
<nav>
<!-- Din navigation -->
</nav>
<div>
<{$contents}>
</div>
</body>
</html>
/{navn}/templates/index.html
This template is used to display the content of whatever you're viewing. That is, a product, a landing page, or the shopping cart, etc. Here's a suggestion for what it might look like:
<{if $inc}>
<{include file=$inc}>
<{elseif $category}>
<{include file="category.html"}>
<{elseif $landing_page}>
<{include file="landing_page.html"}>
<{elseif $product}>
<{include file="product.html"}>
<{elseif $page}>
<{include file="page.html"}>
<{elseif $blog_post}>
<{include file="blog_post.html"}>
<{/if}>
/{navn}/templates/printed_invoice.html
Used from admin when you want to print a packing slip. The content of the order is always available in the variable $order.
/{navn}/templates/mails
If you want to send your customers an email some time after their purchase.
$products
$order
Email that can be sent automatically if the customer has entered their email address but not checked out.
$basket_url
$basket
Email that can be sent when a product is back in stock and the customer has signed up for it.
$product
Email to the dropshipping supplier.
$products
$order
The invoice for the order.
$order
Email sent if the order is credited.
$order
Email sent when the order is shipped.
$order
Email sent when the order is ready for pickup in store.
$order
Email sent when the order has been picked up in store.
$order
If the customer has placed an order but not completed the payment.
$payment_url
$order
Email that can be sent to the customer if you want to collect reviews.
$order
Email with a link to reset the password. To get the URL, use $customer->getTokenUrl().
$customer
Welcome email if the customer creates an account in the shop.
$customer
Email sent to the customer when their points expire.
$customer
$points_to_expire
$points_expire_date
Email sent to the customer when they create a return via the return center.
$order_return
Email sent to the customer with a return label (PDF or QR code). If the store owner has enabled GLS QR code return labels, the QR code can be shown inline in the email with $order->getGlsReturnQr(), which returns the path to the QR code image (or null).
$order
$order->getGlsReturnQr()
Email sent to the customer when a return is approved as store credit instead of a refund. Contains the gift card code, the amount, and the expiry date. Only sent if the store owner has enabled "Offer store credit" in the return center and the customer has chosen it.
$order_return
$voucher->getCode()
$voucher->getPriceDiscount()
$voucher->getExpires()
Confirmation sent to the customer when a return is approved and the amount is refunded to the card (a regular refund, or the difference on a cheaper exchange where the customer chose a refund).
$order_return
$amount
$refund_to_payment_method
Email sent to the customer when they create an exchange via the return center, confirming that the exchange request has been received. Falls back to return_received.html if the theme does not have it.
$order_return
Sent upon approval of an exchange for an item that is more expensive than the returned item. Includes a payment link for the new order: either the full price (the returned item will be refunded to the card) or just the difference, when the store allows the customer to pay the price difference immediately.
$order_return
$order
$payment_url
Sent when a cheaper exchange is approved and the customer chose to receive the remaining amount as store credit. Contains the gift card code. Falls back to return_voucher.html if the theme does not have it.
$order_return
$voucher->getCode()
$voucher->getPriceDiscount()
Receipt sent to the customer when they withdraw from a purchase via the digital withdrawal function (durable medium, legal requirement). Located in the theme next to withdrawal.html.
$order
$reason
$withdrawal_time
Receipt sent to the customer when an order's status is changed to "Canceled". Cancellation emails are turned off by default and must be enabled per webshop under Settings → Emails (the same setting controls both the customer receipt and the store's notification, so bulk or automatic cancellations don't spam anyone). The customer email is also only sent if the template exists in the theme.
$order
$reason
$cancellation_time
General structure of email templates
By default, all email templates are divided into two parts: one part for the subject line and the other
part for the body. The template is divided by checking whether the variable $subject is
set. If it is, the template returns the subject. Otherwise, it returns the content. Example:
<{if $subject}>
Emnet på mailen
<{else}>
Indholdet af mailen
<{/if}>
However, this does not apply to the two emails invoice.html and
invoice_dropshipping.html, where the subject is controlled via admin
admin and not via the template.
Blocks in the Email Editor (Design > Emails)
The store can build its emails using blocks under Design > Emails. If the email has a published and active setup, it will be sent instead of the theme’s file in templates/mails. Without a setup, the theme’s template is used as before. If the setup fails when the email is created, the customer receives the theme’s email, and the store receives a notification under Messages. The dropshipping email (invoice_dropshipping.html) is not included in the editor.
The theme's own blocks
The theme can provide its own versions of the editor's blocks in the templates/mails/blocks folder:
mails/blocks/<type>.html(e.g.,header.html,button.html, ororder_products.html) overrides the core block of that type.mails/blocks/layout.htmloverrides the container for the blocks (the document,<head>, the background, and the footer). The layout retrieves the finished blocks from$mail_contentand outputs them where the content should appear.
A block is retrieved from the first available source: the store’s own code for the block in the editor, the theme’s file, and finally the core template. The store’s code therefore takes precedence over the theme’s file. If the store has written code for the entire email, neither the theme’s blocks nor its layout are used. Each block is wrapped in <div class="mail-block mail-block-<type>">, and a block that doesn’t display anything is omitted. The core’s code for a block can be viewed on the block’s Code tab in the editor (requires access to Code). The tab always displays the core code, even when the theme has its own file. The preview in Design > Emails uses the theme’s blocks with test data from the store.
The blocks and layout will have the following variables:
| Variable | Content |
|---|---|
$block | The block's settings from the editor, such as $block.text, $block.align, and $block.show_images. The button also has $block.href (a code such as [order_url] or a custom URL), the image $block.image_url, and the spacing $block.half (half the height). |
$design | A common email template with default values for options the store has not selected. Colors: $design.button_bg, $design.button_color, $design.link_color, $design.text_color, $design.heading_color, $design.muted_color, $design.background, $design.content_bg, $design.box_bg, and $design.border_color. Dimensions in pixels: $design.width, $design.radius, $design.button_radius, and $design.font_size. Additionally, $design.font_family (a font stack), $design.logo_url, and $design.custom_css. |
$webshop, $order, $order_return, $customer, $recurring_order, $basket, $tickets, $shipment … | The email's own variables—the same ones that the theme's email template receives. Variables that the email does not have are set to null, so check, for example, with <{if $shipment}>. Return emails also receive $order (the order associated with the return). |
$mail_content | Only in layout.html: the finished blocks. |
Block Types
The file name in emails/blocks is the block type. The emails are named after the theme's email file without the .html extension.
| File | Block in the editor | Used in |
|---|---|---|
header.html, text.html, button.html, image.html, divider.html | Logo, Text, Button, Image, and Spacing | All emails |
code.html | Code (the store's own Smarty code) | All emails |
order_details.html, order_products.html | Order Details and Items | invoice, order_sent, order_ready_for_pickup, order_picked_up, order_cancelled, order_credit, withdrawal_received, payment_mail, down_payment_remainder, after_purchase, product_review_mail |
payment_info.html | Payment details | invoice |
order_vouchers.html | Store credits | invoice |
withdrawal.html, terms.html | Right of Withdrawal and Terms and Conditions (must be included in the order confirmation) | invoice |
tracking.html | Tracking | order_sent |
pickup_address.html | Pickup address | order_ready_for_pickup |
event_details.html | Order number, time, and reason | order_cancelled, withdrawal_received |
down_payment_summary.html | Remaining balance | down_payment_remainder |
return_label.html | Return label | return_label |
refund_details.html | Amount to refund | return_refund |
voucher_details.html | Store credit | return_voucher, return_exchange_voucher |
exchange_info.html | How the exchange works | return_exchange_received |
exchange_payment.html | Exchange difference | return_exchange_payment |
basket_products.html | Products in the cart | basket_mail |
recommendations.html | Recommended products | after_purchase |
product_card.html | Product | in_stock_mail, ticket_waitlist |
password.html | Temporary password | user-welcome-mail |
subscription_details.html | Subscription details | subscription_confirmation, subscription_open |
tickets.html | Tickets | tickets |
ticket_info.html | Date and venue | ticket_reminder, ticket_cancelled |
The product line in Products (order_products)
The core's ` order_products.html ` contains the loop for the order lines and the summary. Inside the loop is the placeholder @@ITEM@@, and before the block is rendered, the product line is inserted there: either the store’s own product line from the editor (the Product Line tab) or the core’s order_products.item.html. The product line refers to the current order line as $line.
If the theme provides `mails/blocks/order_products.html`, the file is rendered as-is. The placeholder is not replaced in the theme’s file, so the theme must render the product row in its loop itself—either directly or using a `<{include}> ` of another file within the theme. There is no theme file for the product line alone. If the store has written its own product line, the theme’s order_products.html is skipped, and the core block is used with the store’s product line. Use the order’s currency ($order->getCurrency()), and display only the items in the package when $shipment->isPartial() is true in “Order Shipped” (the items are listed in $shipment->getProducts()).
Smarty and code snippets
- The theme's blocks and layout run in the same secure mode as the theme's other templates, with the same features and modifiers.
- Emails from the editor are generated using Smarty 4 when sent from the admin panel, the queue, or cron, even in stores where the front end runs Smarty 2. Therefore, write the blocks using Smarty 4 syntax. If an email is generated directly on a storefront running Smarty 2 (e.g., the welcome email), the theme’s email template is used. How to switch to Smarty 4
- Placeholders such as
[order_id],[customer_first_name], and[order_url]are replaced after the entire email has been rendered, including in the theme’s blocks and layout, but never inside the<style>tag. In the email’s content, the value is escaped as HTML, and in the subject line, it is plain text. The email’s placeholders without a value become empty, and other text enclosed in square brackets remains unchanged. Therefore, simply output$block.hrefusing|escape. - An error in the theme's block file is handled like other configuration errors: the customer receives the theme's email, and the store receives a notification.
Example: templates/mails/blocks/button.html with the theme's own appearance and the colors from the email design.
<{* Knap: $block.href er en kode som [order_url] eller en fri adresse *}>
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin:8px 0 24px 0;">
<tr>
<td align="<{$block.align}>" style="padding:16px;background-color:<{$design.box_bg}>;border-radius:<{$design.radius}>px;">
<a class="mail-button" href="<{$block.href|escape}>"
style="display:inline-block;padding:14px 28px;background-color:<{$design.button_bg}>;color:<{$design.button_color}>;border-radius:<{$design.button_radius}>px;font-weight:700;text-transform:uppercase;text-decoration:none;"><{$block.text|escape}></a>
</td>
</tr>
</table>
Images, stylesheets, etc. in the theme
You can place your images, stylesheets, etc., wherever you like, but we recommend that you use a structure such as
/{name}/images and /{name}/css. When referencing the files, you must use the variable
$theme_url, which contains the theme’s URL. Note that this may change, so you cannot always
enter the URL manually in your theme. However, the variable will always work. If you want to link to the image
/{name}/images/img.gif, you should therefore write
<img src="<{$theme_url}>/images/img.gif">.
Extensions
Shoporama contains several different data types, such as products and categories. These data types include some
predefined fields, such as title, description, and price. It is possible to extend the most common data types
with your own fields. Extensions must be placed in the theme in the file /{name}/extensions/{datatype}.json, where
the possible data types are product, landing_page, category, static_page,
and blog_post.
The JSON file must contain an array of groups, where each group contains a number of fields. The format is as follows:
name
string
The name of the field group
description
string
Longer description
fields
array
Array of fields
Field properties:
title
The title of the field
description
Longer description, if relevant
id
ID used to retrieve the value
type
One of the following types:
options
Values if type is either list or multi. The format is
"options": {
"foo": "Foo",
"bar": "Bar",
"baz": "Baz"
}
placeholder
Optional placeholder
default
Default value
searchable
Optional bool. Only for product extensions. Text fields (text, string, longtext, richtext, wysiwyg, list, multi) are automatically indexed in the product search, so that, e.g., an author name or product group can be found. Set "searchable": false to keep a field out of the search. Fields without the flag are included (backward compatible).
repeater
Used to create repeating groups of fields that the store owner can add or remove dynamically. Repeater items can be dragged and dropped to change the sort order. Requires a fields array that defines the sub-fields.
Extra properties:
field_title- Name of a single item (e.g. "Feature", "Slide", "Point")fields- Array of subfields (supports: text, richtext, longtext, number, image, images, video)
decimal, link and references
"decimal" is a number with decimal places, including negative numbers (while"number" refers only to integers starting from 0). "link" is an address (https://..., /path, mailto:, or tel:). These reference types point to other content in the store and are stored as IDs:product/products,category/categories, andcontent_entry/content_entries (posts from a content type). In the admin panel, they can be selected using a search.
Additional property:
content_type- Only content_entry/content_entries: the key for the content type that the field points to, e.g., "recipe"
Below is an example of the JSON in the file extensions/product.json:
[
{
"name": "Billeder",
"description": "Her kan du tilføje billeder",
"fields": [
{
"title": "Et enkelt billede",
"id": "my-image",
"type": "image"
},
{
"title": "En serie af billeder",
"id": "my-images",
"type": "images"
}
]
},
{
"name": "Indstillinger",
"description": "Herunder kan du indstille diverse",
"fields": [
{
"title": "my-setting",
"description": "Vælg flere ..",
"id": "tags",
"type": "multi",
"options": {
"foo": "Foo",
"bar": "Bar",
"baz": "Baz"
}
}
]
},
{
"name": "Features",
"description": "Produktfeatures med ikoner",
"fields": [
{
"title": "Features",
"id": "features",
"type": "repeater",
"field_title": "Feature",
"description": "Tilføj features for produktet",
"fields": [
{
"id": "title",
"type": "text",
"title": "Overskrift",
"placeholder": "Fx: Vandtæt"
},
{
"id": "description",
"type": "longtext",
"title": "Beskrivelse"
},
{
"id": "icon",
"type": "image",
"title": "Ikon"
}
]
}
]
}
]
Gives the following interface:
For data types that support extensions, the values must be retrieved using the getExtensionValue('ID') method,
where ID is the ID from the json file. Depending on the field's data type, the content may be returned as text, an array, or an object.
Example:
Materiale: <{$product->getExtensionValue('materiale')}>
Or:
<{if $img = $product->getExtensionValue('img')}>
<{$img->getSrc(50, 50, 'fit')}>
<{/if}>
Or if you want to loop through images:
<{foreach $product->getExtensionValue('my-images') as $image}>
<img src="<{$image->getSrc(50, 50, 'box')}>">
<{/foreach}>
For repeater fields, you can loop through the items. Image fields in repeaters are returned as Image objects:
<{foreach $product->getExtensionValue('features') as $feature}>
<div class="feature">
<{if $feature.icon}>
<img src="<{$feature.icon->getSrc(64, 64, 'box')}>" alt="">
<{/if}>
<h3><{$feature.title|escape}></h3>
<div><{$feature.description|escape|nl2br}></div>
</div>
<{/foreach}>
A video field (including as a subfield in a repeater) returns the video's URL in the video archive as a string. An "images" subfield in a repeater returns a list of SafeImages in the order selected by the store owner:
<{* video-felt: URL'en til en mp4- eller webm-fil *}>
<{if $product->getExtensionValue('video')}>
<video controls playsinline preload="metadata">
<source src="<{$product->getExtensionValue('video')|escape}>">
</video>
<{/if}>
<{* repeater med sub-felterne title (text), photos (images), og clip (video) *}>
<{foreach $product->getExtensionValue('steps') as $step}>
<h3><{$step.title|escape}></h3>
<{foreach $step.photos as $photo}>
<img src="<{$photo->getSrc(300, 300, 'box')}>" alt="<{$photo->getDescription()|escape}>">
<{/foreach}>
<{if $step.clip}>
<video controls playsinline preload="metadata" src="<{$step.clip|escape}>"></video>
<{/if}>
<{/foreach}>
For date and datetime fields, the value can be used directly or formatted with Smarty's date_format:
<{* Date felt - vis kun dato *}>
Lanceringsdato: <{$product->getExtensionValue('publishdate')|date_format:'%d/%m/%Y'}>
<{* Datetime felt - vis dato og tid *}>
Publiceringsdato: <{$product->getExtensionValue('publishdatetime')|date_format:'%d/%m/%Y kl. %H:%M'}>
<{* Tjek om produktet skal vises baseret på dato *}>
<{if $launch_date = $product->getExtensionValue('publishdate')}>
<{if $launch_date|strtotime <= $smarty.now}>
<!-- Produktet er lanceret -->
<{/if}>
<{/if}>
<{* Sammenlign datoer *}>
<{if $product->getExtensionValue('publishdatetime')|strtotime > $smarty.now}>
Kommer snart: <{$product->getExtensionValue('publishdatetime')|date_format:'%d. %B %Y'}>
<{/if}>
Reference fields return the objects directly: a single field returns an object (or null), and a plural field returns a list. Only visible content is included (products and categories that are online, entries that are online), in the order they were selected in admin:
<{* Udvidelse på blogindlæg: {"id": "opskrift", "type": "content_entry", "content_type": "opskrift"} *}>
<{if $opskrift = $blog_post->getExtensionValue('opskrift')}>
<a href="<{$opskrift->getUrl()}>"><{$opskrift->getTitle()|escape}></a>
<{/if}>
<{* products giver en liste af produkter *}>
<{foreach $product->getExtensionValue('tilbehoer') as $p}>
<a href="<{$p->getUrl()}>"><{$p->getName()|escape}></a>
<{/foreach}>
Content Types
Under Content → Content Types, the store owner can create new content types—such as Recipes, Hotels, or Retailers—with the fields required for each type. Each type gets its own menu item where entries are created. The types are stored in the store and not in the theme, so they are retained when you switch themes. The fields have the same types as the extensions mentioned above.
The theme only knows the type's key, e.g. opskrift. The key is shown on the type in admin and cannot be changed, so the store owner can rename the type without breaking the theme. Field values are retrieved using the field's key.
<{* De 6 første opskrifter i admin-rækkefølge *}>
<{foreach $webshop->getContentEntries('opskrift', 6) as $opskrift}>
<article>
<{if $image = $opskrift->getImage()}>
<img src="<{$image->getSrc(400, 300, 'box')}>" alt="">
<{/if}>
<h3><a href="<{$opskrift->getUrl()}>"><{$opskrift->getTitle()|escape}></a></h3>
<p><{$opskrift->getValue('tilberedningstid')}> min. · <{$opskrift->getLabel('svaerhedsgrad')}></p>
</article>
<{/foreach}>
<{* Én bestemt post ud fra slug eller id *}>
<{if $hotel = $webshop->getContentEntry('hotel', 'strandhotellet')}>
<{$hotel->getTitle()|escape}>: <{$hotel->getValue('stjerner')}> stjerner
<{/if}>
The type is defined in admin, so the theme must always handle the type or a field being missing: check with if before using a value. All methods are described under SafeContentEntry, SafeContentType, and SafeWebshop in the class documentation. The most important ones:
| $webshop->getContentEntries(type, limit, offset, sort) | Entries that are online. sort is weight (the sort order in admin), title, newest, oldest, updated, or field:key |
| $webshop->getContentEntry(type, slug) | One entry by slug or ID, or null |
| $webshop->getContentType(type) | The type with getName(), getNameSingular(), getUrl(), and getEntryCount() |
| $entry->getValue(key) | The value of the field. Images are SafeImage, video is the video's URL, references are objects, yes/no is true/false, and multiple selections are a list. In repeated rows, a gallery is a list of SafeImage |
| $entry->getLabel(key) | Value as display text: the name of the selected item in a drop-down list, Yes/No, dates as 24.12.2026 |
| $entry->getFields() | All filled-in fields are listed with key, title, type, value, and label for generic display. Repeated rows also have sub_fields |
| $entry->getImages() / getImage() | The entry's image gallery / first image |
| $entry->getUrl() | The URL of the entry's own page, or null if the type does not have a dedicated URL |
Dedicated pages for the entries
If the store owner turns on Dedicated URL for the type, each entry gets a page at /prefix/slug and the type gets an overview page at /prefix, e.g. /recipes/rhubarb-trifle and /recipes. The pages are displayed via $inc just like the other pages, using these templates:
content_opskrift.html(the type's key) or the genericcontent_entry.htmlfor an entry. Variables:$content_entry,$content_type, and$breadcrumbscontent_opskrift_list.htmlor the genericcontent_list.htmlfor the overview. Variables:$content_entries,$content_type,$pager, and$breadcrumbs
If the theme does not include any of the templates, the URL returns a 404 error, and the shop owner receives a notification in the admin panel. Shoporama’s default themes include the generic templates. The title, description, canonical tag, and noindex attribute are set the same way as on other pages, and the entries are included in sitemap.xml.
The Page Designer
A field of type content_type in a section appears in the Page Designer as a list of the store's content types, and the value is the type's key. The default themes include the "Content entries" section, which shows entries from a selected type:
{"id": "content_type", "type": "content_type", "title": "Indholdstype"}
<{if $section.content_type}>
<{foreach $webshop->getContentEntries($section.content_type, $section.max) as $entry}>
...
<{/foreach}>
<{/if}>
Page types with their own URL can also be designed in the Page Designer, just like blog posts. The page types are named content_entry:<key> (the entries, either specific entries or all of them) and content_list:<key> (the list). In sections.json, the theme specifies the sections under content_entry and content_list. A list for a specific type, such as content_entry:recipe, takes precedence over the general one. The templates display the blocks using $page_blocks_top and $page_blocks_bottom (or $page_blocks, if the theme does not split them up):
{
"content_entry": ["hero", "text", "product-list"],
"content_list": ["hero", "text"]
}
Global variables
$webshop
A general object that contains the online store, but also includes several functions for retrieving
various data from the store. Learn more about the Webshop object.
Example of how $webshop is used to retrieve a list of categories:
<{foreach $webshop->getCategories() as $category}>
<{$category->getName()|escape}>
<{/foreach}>
$max_per_order_notice
Displayed on the page immediately after an item is rejected or its quantity is reduced due to the item’s “Max. quantity per order” limit. The store enforces this limit automatically in the shopping cart and checkout, but the customer only sees an explanation if the theme displays the message. Place it in `global.html` before the page content so that it also appears when the customer adds an item to the cart from a category page. Use `$product->getMaxPerOrder()` to display the limit and as the maximum value in the quantity field. If the theme adds the item to the cart using `fetch`, it receives an HTTP 409 error instead of a redirect when the item is rejected, and the customer must reload the page manually to see the message.
<{if $max_per_order_notice}>
<div id="max_per_order">
<{foreach $max_per_order_notice as $notice}>
<p>Du kan højst købe <{$notice.max}> stk.
af <{$notice.name|escape}> pr. ordre.</p>
<{/foreach}>
</div>
<{/if}>
$webshop->getNewsletters()
Get the shop's publicly shared newsletters and build an archive. Each item is a SafeNewsletterCampaign with methods such as getTitle(), getDate(), getExcerpt(), getImage(), getUrl(), and getContent(). Use $webshop->getLatestNewsletter() to link to the latest one. The shop must have enabled "Show public newsletter archive" under Newsletter.
<{if $webshop->hasNewsletters()}>
<{foreach $webshop->getNewsletters(12) as $nl}>
<a href="<{$nl->getUrl()}>">
<{if $nl->getImage()}><img src="<{$nl->getImage()|escape}>" alt=""><{/if}>
<time><{$nl->getDate()|date_format:"%d. %B %Y"}></time>
<h3><{$nl->getTitle()|escape}></h3>
<p><{$nl->getExcerpt()|escape}></p>
</a>
<{/foreach}>
<{/if}>
$product
The Product object if you are viewing a product page
$category
The Category object if a category is being shown
$landing_page
The landing page object, if you are on a landing page
$page
The object for the static page, if you are on one
$blog_post
The blog post object if you are viewing a blog post
$inc
The name of the special (non-dynamic) page being rendered. Possible values are return.html,
order-return.html,
return-exchange.html,
return_received.html,
return_label.html,
return_voucher.html,
also.html,
search.html,
basket.html,
address.html,
shipping.html,
approve.html,
payment.html,
thanks.html,
order.html,
product_review.html,
subscription.html,
blog.html,
user-sign-up.html,
user-sign-in.html,
user-sign-out.html,
user-edit.html,
user-reset-password.html,
user-profile.html,
user-orders.html,
user-points.html,
user-subscriptions.html,
user-change-card.html,
404.html,
410.html.
Since we validate the content, it is a good idea to use the code below and control the display in an include file:
<{if $inc}>
<{include file=$inc}>
<{/if}>
$shipping
The selected shipping method
$pager_array
Paginates if the current page contains pagination. The array contains the following elements:
max,
current,
total,
url, and
first_url.
$pager
Pager object.
$current_url
The absolute URL of the current page. On a country's own domain, it is the country's address (see Languages and Countries).
$language
The language code the page is displayed in, e.g., da or sv. Only set for shops with countries. $webshop->getLanguageCode() works for all shops (see Languages and Countries).
$top_url
Relative URL of the current page.
$get
An array of all GET variables. Among other things, the system sets:
$get.payment_cancelled— set when a payment is canceled or fails$get.not_found— set when an order cannot be found (returns)$get.wrong_voucher— set when an invalid discount code is used$get.delivery_country— set on the address page when the country does not ship to the selected delivery country (see Languages and Countries)
$post
An array of all POST variables.
$cookie
An array of all COOKIE variables.
$user_id
The ID of the store owner who is logged into the admin panel. This variable is set if you follow a link to the store from the admin panel.
$customer
Customer object if the customer is logged in to the store.
$remote_addr
The IP address of the customer viewing the page.
$admin_url
URL of the Shoporama admin
$selected_payment_gateway
The ID of the selected payment gateway.
$join_mailinglist
Indicates whether the customer has chosen to sign up for the newsletter.
$basket_url
URL of the cart and its contents.
$products_matches
IDs of products that matched a discount or campaign
$campaign_ids
IDs of campaigns if the products in the cart match a campaign.
$campaigns
The active campaigns, if there are any.
$campaign_discount
The discount from the active campaigns.
$campaign_matches
An array of products that match a campaign. If there are no products, the variable is null.
$unpaid_order
If the customer has an unpaid order.
$unpaid_recurring_order
Unpaid subscription.
$basket
the cart contents as an array, where each element is a product in the cart, with the values:
.id
unique ID of the line
.product_id
the product's ID
.in_stock
true/false whether the product is in stock
.product
the product
.attributes
the product's attributes
.own_id
the SKU
.amount
the quantity in the cart
.comment
optional comment
.bundle
array of products if the product is a bundle
Example of how to use the above:
<{foreach $basket as $row}>
<{if $image = $row.product->getImage()}>
<img src="<{$image->getSrc(50, 50, 'box')|escape}>">
<{/if}>
<{$row.amount}> x <{$row.product->getName()|escape}>
i alt
<{$row.product->getRealPrice($row.amount, $row.attributes)|number_format:2:",":"."}>
<{$webshop->getCurrency()}>
<{/foreach}>
Check the Template API to see which methods are available on the various objects.
$subscriptions
The cart's subscriptions. Works the same way as $basket
$price
The subtotal of the cart contents, i.e. excluding shipping.
$shipping_price
The shipping cost for the cart.
$total_price
The total price of the cart contents.
$vat
The VAT on the cart contents.
$deposits
The cart's deposits per deposit type (array with name, units, unit_amount, and total). Show the rows between subtotal and total — the amount is already included in $total_price. See also $deposit_total. On order pages, use $order->getDepositLines() and $order->getDepositTotal(), and per product there's $product->getDepositTotal($amount, $attributes) for a "+ deposit" hint next to the price.
On product pages: $product->hasDeposit() tells you whether the product has a deposit, $product->getDepositCount($attributes) gives the number of deposit units per sales unit (respects variant overrides), and $product->getDepositType() returns the deposit type (or null) with getName(), getAmount() (incl. VAT), getAmountExVat($vat_pct), and getVatShare($vat_pct). On the return status page, $order_return->getDepositRefunds() gives the deposit rows in the return. The lines from getDepositLines() are regular order line objects (getName(), getAmount(), getPrice($antal)) and are filtered out of $order->getOrderProducts(), so existing themes still show correct totals without any changes.
$product->getPricePerUnit()
Unit price for a "DKK/pc" hint below the price (e.g. DKK 4.11/pc). Per product, the store fills in $product->getUnitAmount() (number of base units in the pack, e.g. 24 or 0.5) and $product->getUnitLabel() (the unit as free text: pcs, L, kg …). getPricePerUnit() gives the customer-facing price divided out (respects sale prices, VAT display, customer group, and voucher) — or null if the product has no unit price. For B2B themes that show prices excl. VAT, there's getPricePerUnitExVat().
The built-in themes show the line automatically on product cards and the product page via components/price.html with the include parameter unit_price=true. The calculation is based on the displayed price, so the unit price always follows the main price. It isn't shown for products with variant prices (hasAttributePrice()), since it would otherwise be ambiguous.
$basket_weight
The total weight of the cart (e.g. for shipping).
$total_amount
The total number of products in the cart.
$voucher
The discount code, if there is one.
$voucher_discount
The discount from the discount code.
$shipping_country
The selected delivery country.
$nofollow
Indicates whether nofollow is set on the page.
$meta_title
The page title.
$meta_description
The page description.
$canonical
The page's canonical URL.
$session_order
Array containing the billing address. Contains the following fields:
name, company_name, vat_number, address, address2, zipcode,
city, email, phone, ean_number, comments
$session_del
Array containing the shipping address. Contains the following fields:
name, company_name, address,
address2, zipcode, city
$session_extra
Array with extra fields on the order. If a field is POSTed with
extra[test]=123, then $session_extra.test will be 123, and it will be saved on the order.
$use_points
Number of points the customer has entered to use on the order.
$point_discount
How much the points used (from $use_points) are worth in DKK (or another currency).
$earns
How many points the customer earns by completing the order.
Template functions
Below are the Shoporama-specific functions you can use in templates:
Template language support
You can build language support into your templates. You wrap the text in a <{t}> block, and then the store owner can edit it under Design → Texts and translate it into the language of each of the store’s countries under Web Store → Translations (see Languages and Countries). The text appears in the admin panel the first time the template is rendered, and for stores with multiple countries, the theme’s files are also parsed in advance. Example:
<{t}>Din kurv<{/t}>
Please note that if you change the text in your template files, the new text will appear in the admin panel as a new text entry. There are no IDs or names; it is the content itself that makes the text unique.
You can set the section attribute on the block to divide your text into more manageable
sections. You can also add hint if you want to display a hint in admin when the text is being edited:
<{t section="basket" hint="Bruger i overskriften"}>Din kurv<{/t}>
If you have variable content that you want to include without the value appearing in the admin panel, you can use the following syntax:
<{t amount=$total_amount price=$total_price|number_format:2:$webshop->getDecimalSeparator():$webshop->getThousandSeparator() currency=$webshop->getCurrency() hint="Til kurven"}>Du har {amount} ting til {price} {currency} i kurven.<{/t}>
Write values as placeholders as shown above, and never as a variable within the text itself. The text between the tags is the key, so a variable in the text turns each value into a new piece of text. The same applies to spaces and line breaks within the text, so write it on a single line.
If it fits better into your structure, you can also use t as a modifier for
your variables/functions:
<{$title = "Min titel her"}>
<{$title|t}>
The above will show the following in admin:
Arguments
Section for grouping in admin
Hint shown as help text in admin
Template caching
If a template contains a lot of resource-intensive calls that don’t need to be updated in real time—such as
product variants, the menu, or the category overview—Shoporama includes a caching feature that
can make the store run significantly faster. The functions used are cache and get_cache.
The first marks the section to be cached, and the second later retrieves the cached data. Example:
<{get_cache name="my_cache" ttl=3600 assign="c"}>
<{if $c}>
Fra cache: <{$c}>
<{else}>
Live:
<{cache name="my_cache"}>
<{$smarty.now}>
<{/cache}>
<{/if}>
The cache function wraps the content and assigns it the name specified in name.
To retrieve the content, use get_cache, which takes the arguments name, as
used previously, and ttl, which specifies in seconds how old the content may be. If the argument is omitted,
the default is one hour.
Arguments
Specifies the name of the cached element. You can use dynamic names from variables.
Retrieving cached content
Function that returns the cached content from the cache function.
Arguments
The name of the cached element, as used in cache.
Time To Live. The number of seconds the cache stays valid.
The name of the variable the content should be assigned to.
Theme settings
You can add some general settings to themes by adding a
theme_settings.json file to the root of the theme, resulting in something like the following:
The structure is as follows:
info
The name of the theme
string
features
Array of features the theme includes. Only used for display in admin, and only useful if the theme is general and several users can choose it. E.g. ["Feature A", "Feature B", "Feature C"]
array
demo
URL of a demo page, if any
string
split_blocks
If set to true, the page designer splits the blocks into two zones: above and below the main content of the page. The store owner can drag blocks between the two zones in admin. In the theme templates, $page_blocks_top and $page_blocks_bottom are used to place the blocks correctly. Without this setting, all blocks are shown in a single list. Recommended for themes where page designer blocks should be placeable both above and below the main content (product info, category list, etc.).
boolean
accordion
If set to true, the settings are shown in an accordion layout instead of the classic card layout with a sidebar. The accordion layout includes a search function that makes it easy to find specific settings, and it remembers which sections are open via localStorage. Recommended for themes with many settings.
boolean
smarty_version
Specifies which Smarty version your theme is built for. If the field is set, the theme takes control: Shoporama automatically syncs the shop's Smarty version when the theme is switched, and the choice is locked in the store owner's settings, so the theme and engine always match. Valid values are currently 2 and 4, and the value must match the version folder the theme is in (e.g. 4 for a theme in user_templates/4/). An invalid or not-yet-supported value is ignored, and the store owner's manual choice is kept. If the field is omitted, the behavior is unchanged.
integer
countries
Set to true when the theme is ready for countries: all text appears in <{t}>, and amounts are displayed in the country's currency and number format. If set to false, Webshop → Countries displays the warning "The theme is not ready for countries." If the key is missing in a custom theme, Countries displays “Check the theme before activating a country.” The key does not change how the store functions. See Languages and Countries.
boolean
text_language
The language in which the theme’s <{t}> texts are written, as a language code (e.g., da, en, de, sv, or nb). The default is da. If the texts are written in English ("en", as in Delaware), a country with the language en displays the theme’s own text rather than the store’s Danish edits from Design → Texts, unless the text has been translated into English under Translations.
string
settings
Array of editable fields:
array
.path
ID of the fields included in the variable, used as the first element when the value is retrieved. If path is set to design, the values will be in $settings.design.{feltnavn}
string
.name
Name shown in admin
string
.description
Description shown in admin
string
.fields
The individual fields the user can edit
array
.path
The ID used to retrieve the value. If path is set to color and the parent field was design, the field can be retrieved via $settings.design.color
string
.name
Name shown in admin
string
.description
Description shown in admin
string
.default
Default value. If the field is empty, this value is used.
string
.type
The field type. Valid types are: image, color, string, text, bool, wysiwyg, and list. text is a multi-line textarea without a rich text editor.
string
.values
Values if type is set to list. The format is as follows:
[
{
"name": "cheese",
"value": "Ost"
},
{
"name": "ham",
"value": "Skinke"
}
]
array
Example of file contents
{
"info": "Mit tema",
"smarty_version": 4,
"split_blocks": true,
"accordion": true,
"settings": [
{
"path": "design",
"name": "Design",
"description": "Indstillinger for dit design",
"fields": [
{
"path": "logo",
"name": "Toplogo",
"description": "Upload dit logo her",
"type": "image"
},
{
"path": "background_color",
"name": "Baggrundsfarve",
"description": "Baggrundsfarven på shoppen",
"type": "color"
},
{
"path": "size",
"name": "Bredde",
"description": "Bredden på siden",
"type": "list",
"values": [
{
"name": "Afgrænset",
"value": "boxed"
},
{
"name": "Fuld bredde",
"value": "fullwidth"
}
]
}
]
},
{
"path": "contact",
"name": "Kontaktoplysninger",
"description": "Dine kontaktoplysninger der vises i temaet",
"fields": [
{
"path": "mail",
"name": "E-mail-adresse",
"description": "Indtast din e-mail-adresse her",
"type": "string"
}
]
},
]
}
Both info and settings must be included, or admin will not recognize the format and will not show the settings.
Settings set via the REST API (PUT /theme-settings) or by an AI assistant are validated against this very file: only fields declared here can be set, bool, color, and list values must be valid, image fields must point to an image in the shop's image library, and scripts and other dangerous HTML are removed from text fields. If a single value is invalid, nothing is saved. If the theme has no theme_settings.json, settings cannot be set via the API.
Color schemes
If your theme uses color fields in theme_settings.json, you can offer predefined color schemes by adding a color_scheme.json file to the root of the theme. When the file exists, an extra menu item, "Color schemes", appears under Design in admin, where the store owner can choose a color scheme with one click.
Color schemes only save the color fields defined in the file — all other theme settings are left untouched.
groups
Array of groups that control how the color fields are organized visually in admin. Each group has a label (display text) and a fields array with field references in the format element.name, matching path in theme_settings.json.
array
schemes
Array of color schemes. Each scheme has:
id— Unique ID (used internally to remember the selected scheme)name— Name shown in admindescription— Short descriptioncolors— Object with color values. The keys useelement.namenotation, e.g."theme.primary": "#111827". A scheme does not need to include every color field — only the specified colors are updated.
array
Example of color_scheme.json
{
"groups": [
{
"label": "Grundfarver",
"fields": ["theme.primary", "theme.action", "theme.background"]
},
{
"label": "Sektioner",
"fields": ["theme.header_bg", "theme.footer_bg"]
}
],
"schemes": [
{
"id": "default",
"name": "Standard",
"description": "Det klassiske look.",
"colors": {
"theme.primary": "#111827",
"theme.action": "#2563eb",
"theme.background": "#ffffff",
"theme.header_bg": "#ffffff",
"theme.footer_bg": "#111827"
}
},
{
"id": "warm",
"name": "Varm",
"description": "Varme jordtoner.",
"colors": {
"theme.primary": "#292524",
"theme.action": "#c2410c",
"theme.background": "#fffbeb",
"theme.header_bg": "#fef3c7",
"theme.footer_bg": "#292524"
}
}
]
}
Translations (langs/)
All text in your templates is wrapped in <{t}>...<{/t}>. The first time a page is displayed, each string is detected and added to the store owner’s text list under Design → Texts, where it can be edited. The downside is that the strings only appear as pages are visited, and the store owner must edit everything from scratch. For stores with multiple countries, Shoporama also scans the theme’s files when a country is activated, when Translations is opened, and when automatic translation is running.
With a langs/ folder in the root of your theme, you can supply ready-made translations that are prefilled automatically when the theme is activated. That way the store owner knows all the keys from the start and doesn't have to translate manually.
Folder structure
{navn}/
langs/
da.json
de.json
no.json
sv.json
There is no en.json file — the theme's default text is written in English directly within <{t}>, so English stores do not need translations. If you write the text in a language other than Danish, specify it using "text_language" in theme_settings.json.
JSON format
Each file is divided into sections (typically the name of the file where the text is used). Under each section, the key is the original <{t}> string, and the value is the translation. The section becomes the "Section" filter in the text list.
{
"product.html": {
"Add to cart": "Læg i kurv",
"Sold out": "Udsolgt"
},
"basket.html": {
"Checkout": "Gå til betaling"
},
"404.html": {
"We could not find what you were looking for": "Vi kunne ikke finde det, du søgte"
}
}
Important: The key must match the <{t}> string exactly (leading and trailing spaces are ignored). If it doesn't match character for character, the translation isn't used when the text is displayed.
How the import works
- The import runs automatically when the theme is activated on a store.
- The file is chosen based on the store's language: a Danish store gets
da.json, a German onede.json, and so on. Swedish is accepted as bothsv.jsonandse.json. - All keys are created in the text list, even if the translation is empty — so the store owner sees the full list from the start.
- Only empty fields are filled in. If the store owner has already edited a text, their version is kept — the import never overwrites.
- The import only populates the store's own language. The languages for the store's countries are translated under Webshop → Translations (see Languages and Countries).
Languages and Countries
With Countries (Webshop → Countries), a store can sell in multiple countries with its own language, currency, and address—either as a subpath on the store’s domain (e.g., /se) or on a separate domain. The same theme is used in all countries, unless the store owner chooses a separate theme for each country. A step-by-step guide with a checklist is available in Prepare Your Theme for Multiple Languages and Countries.
What Shoporama handles
- Links in the final HTML (
href,action, andformaction),og:url, and URLs in JSON-LD get the country's address, including links written directly as/basket. Files, images, and feeds are left unchanged, and redirects stay within the country. <html lang>andand:locale(if the theme has tagged it) retrieve the country's language, and hreflang links are inserted for all language versions of the page, plusx-defaultfor the main country. A page that hasn’t been translated yet is displayed in Danish and is set to “noindex” in that country.- The text and URLs of Safe objects have been translated: products, categories, pages, blog posts, menus, filters, shipping and payment methods, countries, customer fields, and the text fields in the theme settings (the types
string,text, andwysiwyg). If a translation is missing, the Danish text will be displayed. - All product prices are already in the local currency (exchange rate, price adjustment, VAT, and rounding), and
$webshop->getCurrency()returns the local currency. Never perform currency conversions yourself in the theme. - Ajax calls from a page in a specific country, the page cache, and fragments in
<{cache}>follow that country. Order emails are generated in the country where the order was placed, so the text, currency, and number format in the email templates follow the order.
What the theme must do
- All visible text within
<{t}>or"..."|t, including emails, the checkout page, and attributes. Values are included as placeholders (see Template Functions). "countries": trueand, if applicable,"text_language"in theme_settings.json once the theme is ready.- The currency using
$webshop->getCurrency()(or$webshop->getCountryCurrency(), which is only populated when the country sells in its own currency, in themes with a fixed text such as "kr."), and amounts from orders using$order->getCurrency(), also in the order history and emails. - Number formatting using
getDecimalSeparator()andgetThousandSeparator(). - A language selector using
$webshop->getCountrySites(). - Delivery country from
$webshop->getDeliveryCountries()and a message when$get.delivery_countryis set. - No custom hreflang links (Shoporama doesn't remove them), and no addresses built in JavaScript (they don't include the country path).
Amounts and Number Formats
<{$decimal = $webshop->getDecimalSeparator()}>
<{$thousand = $webshop->getThousandSeparator()}>
<{$product->getPrice()|number_format:2:$decimal:$thousand}> <{$webshop->getCurrency()|escape}>
<{* Beløb fra en ordre: ordrens valuta *}>
<{if $order}>
<{$order->getTotalPrice()|number_format:2:$decimal:$thousand}> <{$order->getCurrency()|escape}>
<{/if}>
getDecimalSeparator($default = ",") and getThousandSeparator($default = ".") return the characters used in the country where the page or email is displayed (e.g., period and comma in the UK, comma and hard space in Sweden and Finland), and otherwise your argument. The format follows the country, not the language. In JavaScript, for example, $webshop->getLocale() returns en-GB for a country and the store’s own locale, such as da-DK, for the main country.
Language Selector
<{$country_sites = $webshop->getCountrySites()}>
<{if $country_sites}>
<nav aria-label="<{t}>Vælg sprog<{/t}>">
<{foreach $country_sites as $country_site}>
<a href="<{$country_site.url|escape}>" hreflang="<{$country_site.hreflang|escape}>" lang="<{$country_site.language|escape}>"<{if $country_site.current}> aria-current="true"<{/if}>><{$country_site.label|escape}></a>
<{/foreach}>
</nav>
<{/if}>
The list includes the main country and the active countries, and is empty when there are fewer than two. Each item includes, among other things, label (the name of the language in that language, e.g., Svenska), url, address, hreflang (e.g., sv-SE), language, code, country, current, main, and translated. If the URL points to a different domain, it goes through a redirect page that carries over the shopping cart. Always set ` hreflang ` on the link. Links with ` hreflang ` or ` data-country-keep ` are not redirected to the country where the customer is located. See Montana’s ` components/country-selector.html ` and ` components/country-switch.html`.
Delivery country
<{if $get.delivery_country}>
<p><{t}>Vi leverer ikke til det valgte land. Vælg en leveringsadresse i et af de lande, vi leverer til.<{/t}></p>
<{/if}>
<select name="del_country_id">
<option value=""><{t}>Vælg land<{/t}></option>
<{foreach $webshop->getDeliveryCountries() as $country}>
<option value="<{$country->getCountryId()}>"<{if $session_del.country_id == $country->getCountryId()}> selected<{/if}>><{$country->getName()|escape}></option>
<{/foreach}>
</select>
Only the shipping address is restricted. The country for the billing address (order_country_id) is selected from $webshop->getCountries(), which contains all countries available in the store. If the country does not ship to the selected shipping country, Shoporama redirects the customer back to /address?delivery_country=1.
Test a country that is not active
An admin who can edit the store can view a country before it’s active: click the “Show webshop” eye icon in the admin panel and open the country’s path, e.g., /se/. The pages will be set to noindex. The language selector and hreflang tags only display active countries, so they can only be tested once at least one country is active. If the countries are on their own domains, you must be logged in to that country’s domain. The domain is entered, and free SSL is ordered, on the country’s page in the admin panel.
Other new methods and variables: $webshop->getLanguageCode() returns the page's language (e.g., sv) for the <html lang> attribute, even for shops without a country. $language does the same, but is set only for shops with a country, and $current_url is the country's address on its own domain. See the methods in the Template API.
Edit the theme with Claude
If the store is connected to Claude via the Shoporama connector, Claude can copy the theme, make changes to the copy, preview it, and go live with it when the store owner gives the go-ahead. The live store remains unaffected while work is in progress. You can do the same using your own tools with the REST API (see REST endpoints). The guide for store owners is available in Edit Your Theme with Claude.
Smarty 4 and Pro only: Copying, previewing, tracking templates, activating, and deleting custom themes require that the store runs Smarty 4 and is on the Pro pricing plan, and the syntax check for templates only runs on Smarty 4. A copy is a custom theme, so on other pricing plans, the endpoints return a 403 with the error_code: requires_pro. On the Pro plan without Smarty 4, the error code is feature_not_enabled (for a copy, it is copy_not_enabled). GET /REST/theme-copy returns whether the store can create copies in ` copy_enabled ` and ` copy_disabled_reason`. `copy_disabled_reason` can be `smarty_version`, `requires_pro`, or `history_disabled`.
The Workflow
- Copy.
theme_copycopies one of the store’s own themes or one of the default themes (Alaska2, California, Delaware, DelawareDK, Montana, MontanaB2B, and Washington) to a new folder among the store’s own themes. Partner themes from the Theme Store cannot be copied. Build files are not included:node_modulesand, in the theme’s root directory,src,build.sh,package.json,package-lock.json, andtailwind.config.js. The name must be 1–64 characters (letters, numbers,-, and_). A maximum of 10 custom themes per store and 500 MB per copy. A copy of a standard theme will not receive Shoporama’s future updates to that theme. The copy is located under Design → Theme under “Custom Themes.” - THEME.md. Claude should read
thetheme'sTHEME.md fileand the theme documentation (theme_docs_get, e.g., the "workflow," "assets," and "page_builder_modules" sections) before making any changes. See THEME.md below. - Search and trace. `
theme_file_search` searches the theme's text files like `grep` and returns up to 200 hits with line numbers.theme_page_template_listrenders a page with the output and lists the templates used by the page in order, indicating which template included which, along with any template errors. - Changes. `
theme_file_put` writes the entire file to the copy. The live store remains unchanged. - Syntax check. Templates (
.html) are compiled before being saved, and a Smarty error is reported with the line number, e.g., "Smarty syntax error on line 2: unknown tag 'ficlose'." JSON files must be valid JSON. If the check fails, nothing is saved. This check also applies to the code editor in the admin panel. Files such as.phpcan never be saved in a theme. - Preview. `
theme_preview_url` provides a link that is valid for 7 days and displays the store with the preview in the browser that opens it. A cookie keeps the preview active throughout the store, including in the cart and checkout, and a bar at the top displays the "End Preview" link. Other visitors still see the active theme. The pages are marked as "noindex" and are not cached, and errors in the preview do not trigger any messages or emails to the store owner. Emails cannot be previewed because they are sent by the server. - Activate and deactivate.
`theme_activate` witha themesets the copy live. `previous: true` activates the theme from before the most recent change, and`default: true` removes the custom theme so the store displays its default theme (or its theme from the Theme Store).`dry_run: true` only shows what would happen. The response, even with`dry_run`, includes`pages_missing_modules` with the pages from the Page Builder that are online (or scheduled) and use modules that the new theme does not have, anda warning(text ornull). The change isn’t blocked, but the pages display the error message “You’re missing the section” until they’re offline, and Design → Theme displays a warning listing those pages. If the store has “Extra Security” enabled, the activation must be approved in the admin panel. The switch appears in the activity log as “Theme changed.”
Versions
Every time a file in one of the store’s own themes is overwritten or deleted via Claude, the REST API, or the code editor, the old version is saved. The most recent 20 versions per file are saved. Changes made via SFTP are not saved as versions. During a restore, the current version is saved first so that the restore can be undone, and a deleted file can also be restored. Claude uses theme_file_history_list and theme_file_restore, and in the code editor, this is the "Previous versions" button.
THEME.md
Claude sees one file at a time. That’s why all the default themes have a THEME.md file in the root directory that lists the theme’s folder structure, which template displays which page, the shared components, the page designer modules, CSS and JS files, the theme settings, and the theme’s pitfalls. The file is included when the theme is copied. If you’re developing your own theme, you can place a THEME.md file in the theme’s root directory so that Claude has the same overview: Claude is asked to read it before making any changes to the theme. An excerpt from Montana’s:
# Montana: theme guide ## Page → template | Page | Template | |---|---| | Category / product / product gone | `category.html` / `product.html` / `410.html` | | Basket | `basket.html` | [...] ## Pitfalls - `add-to-cart.html` and `price.html` are shared by the product page, product cards, basket and mini basket. Test all of them after a change. [...]
Files and images in the theme
theme_file_putaccepts text (content), a file that the shop owner has attached in the chat (upload_id), a public URL (source_url, such as a font file), or a small file that Claude generates himself (content_base64).- Text files may be no larger than 2 MB, and images, fonts, PDFs, and videos may be no larger than 10 MB. The content must match the file extension (a
.pngmust be a PNG). - In templates, link with
<{$theme_url}>/images/icon.svg.$theme_urlpoints to the theme being displayed, so the same template works in the copy, in the preview, and after activation. Never specify the path to the theme folder directly. - In CSS files, a path relative to the CSS file is used, such as
url(../images/hero.jpg). - Browsers cache theme files for a long time. If you replace a file under the same name, increment
?v=in the link, or use a new filename. - Images that the shop owner needs to be able to change themselves (e.g., banners) belong in the image library and in the image fields of the page designer or theme settings, not in the theme itself.
Theme Settings and Pre-built CSS
- The theme settings are shared. The values are saved per store, not per theme, so the copy and the live theme use the same settings. This also applies to the logo and the store’s stylesheet (Design → Stylesheet). Therefore, Claude does not change them while working on a copy, and CSS that applies only to the copy must be placed in a CSS file within the copy.
- The CSS is pre-built. Montana, MontanaB2B, and Washington use Tailwind, and Delaware and DelawareDK have a pre-built
dist/styles/app.css. A copy has no build step, so any Tailwind class that the theme doesn’t already use won’t be present in the CSS. Use classes that are already in the theme (find them with`theme_file_search`) or plain CSS in a file within the copy.
REST endpoints
Claude's tools use the same endpoints, which you can call directly. They require an API key with the "Access to theme files" checkbox selected (the connection via the Shoporama connector gets this automatically). Only /theme-docs can be used without one. Fields and responses are listed in the Swagger documentation.
GET /REST/theme-copy: What the store can do (copy_enabled, custom themes, default themes that can be copied, and limits).POST /REST/theme-copy: copy a theme (source_kindisownorstandard, plussourceandname).DELETE /REST/theme-copy/{navn}: delete one of your own themes that is not in use. The folder is moved to a trash folder, where support can find it for 30 days.GET /REST/theme-search/{tema}?q=®ex=&folder=: Search the theme's text files.GET /REST/theme-trace/{tema}?page=/: the templates a page uses, in order, plus template errors.PUT /REST/theme-file/{tema}/{fil}: write a file with the file as the body, or with?upload_id=or?source_url=instead. A Smarty or JSON error returns422with the error.GET/POST /REST/theme-history/{tema}/{fil}: the versions of a file, and restore a version usingversion_id.GET /REST/theme-preview/{tema}?page=&theme_page_id=: Preview link valid for 7 days.POST /REST/theme-activate: activate withtheme,standard, orprevious, and optionallydry_run. The response haspages_missing_modulesandwarning.GET /REST/theme-docs,GET /REST/theme-docs/{id}: the theme documentation that Claude reads, in Markdown.?theme=at/REST/page-builder-component,/REST/page-builder-page, and/REST/page-builder-row(see New Modules in a Copy).
Page designer
The Page Designer is a tool for building content using sections based on JSON files. These sections can
be placed on different pages in the online store. The pages on which they can be placed are defined in the file
/{name}/components/sections.json. The content of each section is defined in its own file, which
is located in /{name}/components/sections/{section}.json.
If you have followed the steps above, the Design link at the top of the admin panel will automatically take you to the Page Designer:
Sections are structured as follows:
/{navn}/components/sections.json
File: sections.json
Contains a list of page types and an array of permitted sections. In addition to page types, you can also use custom tags.
{
"Sidetype": ["sektionA", "sektionB"]
}
The following page types are available:
product
Product pages
category
Category pages
landing_page
Landing pages
static_page
Pages
blog_post
Blog post
basket
Cart
address
Address page
shipping
Shipping page
approve
Approval page
thanks
The thank-you page the customer typically sees after completing the order. Supports post-purchase upsell (see below).
upsell-order
Endpoint for post-purchase upsell. Receives the customer's choice from the thank-you page, creates a new order with the same details as the order just completed, and sends the customer straight to payment.
search
Search result page
also
The upsell page, which can be used if you show an upsell page after the customer has added products to the cart
order
The order page, which shows the contents of the order via a link
#tags
Optional tags you create yourself
An example of a sections.json where the user may add the
slider, photos, and quiz sections to landing pages, but
only slider to product pages, and may insert
an about section in #footer, would look like this:
{
"landing_page": ["slider", "photos", "quiz"],
"product": ["slider"],
"#footer": ["about"]
}
/{navn}/components/tags.json
File: tags.json
#footer that you can display at the bottom of the store,
or a #xmas layout that you only use in December. The format for tags.json is:
{
"tag1": "Beskrivelse ...",
"tag2": "Beskrivelse ...",
"tag3": "Beskrivelse ..."
}
Each tag automatically appears in admin when the user creates a new setup:
To retrieve the content of tags in the theme, use the
getBlocks() function as follows:
<{if $blocks = $webshop->getBlocks("#foo")}>
<{foreach $blocks as $block=>$elements}>
[...]
<{/foreach}>
<{/if}>
/{navn}/components/sections
Directory: sections
slider, its content must be located in
/{name}/components/sections/slider.json. The structure of the files is as follows: title
Field: title
The name shown in admin
description
Field: description
Description shown in admin
preview_svg
Field: preview_svg
Optional. Inline SVG markup shown as a wireframe preview in admin when the user selects a section. Use currentColor with opacity for automatic dark/light mode compatibility. The viewBox is 0 0 200 80.
"preview_svg": "<rect x='0' y='0' width='200' height='80' rx='4' fill='currentColor' opacity='0.08'/><rect x='55' y='30' width='90' height='8' rx='2' fill='currentColor' opacity='0.25'/>"
fields
Field: fields
An array of fields
Properties of array elements:
.id
The ID of the field. Used when looping through the content in the theme
string.type
Content type. Valid types are:
list,
text,
integer,
image,
images,
video,
bool,
richtext,
longtext,
repeater,
product,
category, and
landing_page
.options
Only used for fields of type list, and contains a series of options such as:
[...]
"options": {
"hat": "Hat",
"glasses": "Briller",
"beard": "Skæg"
},
[...]
.title
The title of the field
string.description
The field's description
string.max
Maximum number of fields that can be added
int.required
Whether the field is required
bool.placeholder
Placeholder shown in admin
string.default
Optional default value for the field
string.fields
Only used if the type is repeater, and can contain the same fields as sections. A simplified example of a slider repeater could be:
[...]
"type": "repeater",
"fields": [
{
"id": "headline",
"type": "text",
"title": "Overskrift"
},
{
"id": "img",
"type": "image",
"title": "Billedet"
}
]
[...]
.field_title
Only used if the type is repeater, and contains the name of the individual items in the repeater
Views
There are various strategies for retrieving data. By default, there will be a
$page_blocks on the pages that match a configuration. You can loop through it, or the content
can be retrieved using $webshop->getBlocks('#foo').
Alternatively, the content can be accessed using the section name.
As a general rule, we recommend placing the display of each section in separate files, such as
/{name}/templates/sections/{section}.html. This makes it easy to loop through $page_blocks
and include the correct display as follows:
<{if $page_blocks}>
<{foreach $page_blocks as $section}>
<{$type = $section._type}>
<{if $webshop->templateExists("sections/$type.html")}>
<{include file="sections/$type.html"}>
<{/if}>
<{/foreach}>
<{/if}>
Note that the row's type is stored in the variable _type.
We call the section below images, so its content is located in
/{name}/components/sections/images.json.
{
"title": "Overskrift og billeder",
"fields": [
{
"id": "headline",
"type": "text",
"title": "Overskrift"
},
{
"id": "images",
"type": "images",
"title": "Billeder"
}
]
}
This produces the following interface in admin:
To retrieve the content using the method described above,
/{name}/templates/sections/images.html can contain the following:
<h1><{$section.headline|escape}></h1>
<{foreach $section.images as $image}>
<img src="<{$image->getSrc(150, 150, 'box')}>">
<{/foreach}>
When it comes to data types, it's important to pay attention to what each field contains. They can be either
a string, an array, or an object. In other words, you should do something like this:
[...]
<{foreach $section as $name=>$val}>
<{if is_array($val)}>
Repeater or array of images
<{elseif is_object($val)}>
An image
<{else}>
Text, number, or similar
<{/if}>
<{/foreach}>
[...]
The video field type lets the customer select a background video from the store's Video Archive, upload a new one, or drag it onto the field directly in the page designer (e.g., for a hero section). The video is saved in its raw, unscaled form in the store’s public files (maximum 30 MB), and the field returns a string containing the video’s URL. Existing values that are a URL keep working. Supported formats are mp4 and webm. Use an image field in the same section as a poster, shown while the video loads. Recommend that the customer use a short, compressed loop (preferably under 5 MB).
<{if $section.video}>
<video class="w-full h-full object-cover" autoplay muted loop playsinline<{if $section.image}> poster="<{$section.image->getSrc(1600, 900, 'fit', 'webp')}>"<{/if}>>
<source src="<{$section.video|escape}>">
</video>
<{elseif $section.image}>
... show background image ...
<{/if}>
If you use the types product, category, or landing_page, the selected ID
is returned in the theme, and you must retrieve the object yourself using the methods $webshop->getProductById(id),
$webshop->getCategory(id), or $webshop->getLandingPage(id). For example:
[...]
<{if $product = $webshop->getProductById($section.product_id)}>
<{$product->getName()|escape}>
<{/if}>
[...]
Note that you can always use var_dump to check the contents of the variable and
that way loop through it correctly.
New modules in a copy of the theme
Claude can build new modules for the Page Designer in a copy of the theme. A module consists of the three files described above:
components/sections.json: the module name under each page type where it should be selectable.components/sections/{section}.json: title, description,preview_svg, and the fields.templates/sections/{section}.html: the display with the values in$section.
The "Campaign Countdown" module, which Claude built in a copy of Montana, is listed under front, category, and landing_page in sections.json and is described like this in components/sections/kampagne-nedtaelling.json (abridged). The link field type returns a URL as text:
{
"title": "Kampagne-nedtælling",
"description": "Banner med overskrift, tekst, knap og en nedtælling til en slutdato",
"preview_svg": "<rect x='2' y='14' width='196' height='52' rx='8' fill='currentColor' opacity='0.12'/>[...]",
"fields": [
{
"id": "overskrift",
"type": "text",
"title": "Overskrift",
"placeholder": "Black Week slutter snart"
},
{
"id": "slut",
"type": "text",
"title": "Slutter",
"description": "Dato og klokkeslæt, fx 2026-11-30 23:59. Efter tidspunktet skjules banneret.",
"placeholder": "2026-11-30 23:59"
},
[...]
{
"id": "link",
"type": "link",
"title": "Link"
}
]
}
And the view in templates/sections/kampagne-nedtaelling.html (abridged):
<{if $section.slut}>
<div class="claude-countdown">
<div class="claude-countdown-box" data-claude-countdown="<{$section.slut|escape}>">
<{if $section.overskrift}><h2><{$section.overskrift|escape}></h2><{/if}>
[...]
<{if $section.knaptekst && $section.link}>
<a class="claude-countdown-btn" href="<{$section.link|escape}>"><{$section.knaptekst|escape}></a>
<{/if}>
</div>
</div>
<{/if}>
As long as the module is only available in the copy, the rows for it must not be displayed in the live store, because visitors would see the error message “You are missing the section.” Therefore, the workflow is as follows:
- Page builder endpoints take
?theme=with one of the store's own themes:/REST/page-builder-component,/REST/page-builder-page, and/REST/page-builder-row.GET /REST/page-builder-component?theme=Montana-v2shows the copy’s modules and fields, and rows are saved with the copy’s field types. - Rows for a module that only exists in the copy can only be placed on a draft: a page in the Page Designer that is not online and has no schedule (
online_from/online_to). On a page that can be shown, they are rejected with409andmodule_not_in_active_theme. - A preview link displays the copy with the draft:
GET /REST/theme-preview/{theme}?theme_page_id=(in Claude,theme_preview_urlwiththeme_page_id). - The draft cannot be put online until the theme with the module is active. After activating it, put the draft online or move the rows to the right page.
In the Page Designer in admin, such a row is shown with the module's name and the label "Not available in the active theme." It cannot be edited there until the theme with the module is active.
Views
Based on the structure mentioned earlier, the individual views are reviewed below. To understand the individual objects and the methods available, we recommend consulting our Template API.
Download our Alaska theme to see examples of the different views.
Products
The product view can be located in product.html, but this is optional. It is always index.html that
handles the individual views. However, we recommend using this structure. To determine whether a product view is being rendered, the system checks
whether $product is present.
Add to cart
Products are added to the cart by making a POST request to any page—typically just the page you are already
viewing—with the arguments product_id, attributes[{attribut_id}]={attribut_value_id}, and
amount. The attribute should only be added if products have variants.
A simple example of how to add products to the cart could be:
<form action="" method="post">
<input type="hidden" name="product_id" value="<{$product->getProductId()}>"/>
<input type="number" name="amount" value="1" min="1"/>
<input type="submit" value="Læg i kurv">
</form>
With variants:
<form action="" method="post">
<input type="hidden" name="product_id" value="<{$product->getProductId()}>"/>
<{foreach $product->getProfile()->getAttributeList() as $attribute}>
<{if $attribute->getIsVariant() && $attribute->getDataType() == "valuelist"}>
<select name="attributes[<{$attribute->getAttributeId()}>]">
<{foreach $attribute->getValues() as $value}>
<option value="<{$value->getAttributeValueId()}>">
<{$attribute->getName()|escape}>: <{$value->getVal()|escape}>
</option>
<{/foreach}>
</select>
<{/if}>
<{/foreach}>
<input type="number" name="amount" value="1" min="1"/>
<input type="submit" value="Læg i kurv">
</form>
The above can of course be made more elaborate if you want to show stock status, bundles, etc.
If the product is for rent ($product->getIsRental()), the form must also send the rental period in rental_from and rental_to. See Rentals.
If the product is a gift card with a custom amount ($product->getGiftCardAmountRange() returns limits), the form must also send the customer's amount in giftcard_amount. See Gift cards with a custom amount.
Shared Values
The store owner can create shared values (e.g., Small, Medium, Large) and link the profile values to them so that the same value applies across all profiles. $webshop->getSharedValues() returns the store’s shared values in the shop owner’s order as an array, where each entry has an id, value, and num_value. A profile value has a getAttributeSharedValueId() method that returns the ID of the shared value or null. The ID can be used with shared_values on /ajax:
<{* Links til /ajax (JSON) med alle produkter i hver delt værdi, uanset profil *}>
<ul>
<{foreach $webshop->getSharedValues() as $shared_value}>
<li><a href="/ajax?shared_values=<{$shared_value.id}>"><{$shared_value.value|escape}></a></li>
<{/foreach}>
</ul>
<{* Er en variantværdi koblet til en delt værdi? *}>
<{foreach $attribute->getValues() as $value}>
<{if $value->getAttributeSharedValueId()}>
<a href="/ajax?shared_values=<{$value->getAttributeSharedValueId()}>"><{$value->getVal()|escape}></a>
<{/if}>
<{/foreach}>
Landing pages
Landing pages contain a $landingpage as well as $products, which is an array of
products to be displayed on the page.
If the page needs a pager, insert it like this:
<{if $pager}>
<{$pager->render()}>
<{/if}>
Categories
Categories contain a $category as well as $products, which is an array of
products to be displayed on the page.
If the page needs a pager, insert it like this:
<{if $pager}>
<{$pager->render()}>
<{/if}>
Brand Pages
When the store owner enables brand pages under Products → Brands, the store displays an overview of the brands at /brands using the brands.html template and a page for each brand at /brands/<address> using brand.html. The theme must indicate that it can display these pages by including supports_brand_pages at the top of theme_settings.json:
{
"info": "Mit tema",
"supports_brand_pages": true
}
Without the flag, the toggle is gray in the admin panel, and the URLs return a 404 error as before. If one of the templates is missing while the flag is set, the URL returns a 404 error, and the shop owner receives a message under "Messages." A page or category at /brands takes precedence over the overview, and /brand/<address>, uppercase letters in the brand's address (e.g., /brands/Nordic-Roast), and a trailing slash are redirected to the correct address (301). As with categories, the overview and a brand take precedence over a redirect at the same address. Redirects from addresses without a brand—such as an old name—still work.
Use $webshop->hasBrandPages() to check whether brand pages are enabled. $brand->getRemoteUrl() returns the page the brand links to under "Link to," or the brand page itself, and false if there is no page. Here's how to link the brand on the product page:
<{if $product->getBrandName()}>
<{$product_brand_url = false}>
<{if $webshop->hasBrandPages() && $product->getBrand()}>
<{$product_brand_url = $product->getBrand()->getRemoteUrl()}>
<{/if}>
<{if $product_brand_url}>
<a href="<{$product_brand_url|escape}>"><{$product->getBrandName()|escape}></a>
<{else}>
<{$product->getBrandName()|escape}>
<{/if}>
<{/if}>
Themes often set a local $brand on the product page themselves. Therefore, use $is_brand_list and $is_brand_page when shared templates—such as meta tags, structured data, and breadcrumbs—need to know that they are on a brand page.
brands.html returns these variables:
| Variable | Content |
|---|---|
$is_brand_list | True on the overview page. |
$brands | The brands from which the customer can view at least one item, listed in the order they appear in the store. Each brand is a brand object with the methods listed below. |
$brands_title, $brands_text | Headline and introduction from the admin. If the headline is blank, write "Brands". |
$brands_index | True when there are more than 24 brands. Then show the logos at the top, the letters, and a list instead of a single grid. |
$featured_brands | Up to 12 brands with logos, listed in the order they appear in the shop. Only when $brands_index is true. |
$brand_letters | The letter bar. Each letter has letter, key, count, and url, which is either an anchor (#brands-a) or ?letter=a. |
$brand_groups | Brands per letter with Danish sorting (Aa is listed under Å). Each group has letter, key, and brands. Set the group's id to brands-<key> so that the anchors work. |
$brands_paged, $brand_letter | If there are more than 300 brands, one letter is displayed at a time. Without ?letter=, $brand_groups is empty, and only the letters are displayed. An unknown letter returns a 404 error. |
$brands_url, $breadcrumbs | The overview's address and breadcrumbs (title and url). |
<h1><{if $brands_title}><{$brands_title|escape}><{else}>Brands<{/if}></h1>
<{$brands_text}>
<{if !$brands_index}>
<{foreach $brands as $brand}>
<a href="<{$brand->getRemoteUrl()|escape}>">
<{if $brand->getImage()}>
<img src="<{$brand->getImage()->getSrc(300, 200, 'fit')}>" alt="<{$brand->getImageAlt()|escape}>">
<{/if}>
<{$brand->getName()|escape}>
</a>
<{/foreach}>
<{else}>
<{if !$brand_letter}>
<{foreach $featured_brands as $featured}>
<a href="<{$featured->getRemoteUrl()|escape}>"><img src="<{$featured->getImage()->getSrc(300, 200, 'fit')}>" alt="<{$featured->getImageAlt()|escape}>"></a>
<{/foreach}>
<{/if}>
<{foreach $brand_letters as $letter}>
<a href="<{$letter.url|escape}>"><{$letter.letter}></a>
<{/foreach}>
<{foreach $brand_groups as $group}>
<h2 id="brands-<{$group.key}>"><{$group.letter}></h2>
<{foreach $group.brands as $brand}>
<a href="<{$brand->getRemoteUrl()|escape}>"><{$brand->getName()|escape}></a> (<{$brand->getProductCount()}>)
<{/foreach}>
<{/foreach}>
<{/if}>
brand.html contains the following variables:
| Variable | Content |
|---|---|
$is_brand_page | True on the brand page. |
$brand | The Brand. |
$products, $count, $pager | The brand's products without add-ons, the count, and the page navigation ($pager->render()), just like on the category pages. The first page has no p; page 2 is ?p=1; page 3 is ?p=2; and so on. |
$facets etc. | The filter's variables (see Product filtering) when the theme has supports_filters and the store has a filter with the "Brand Pages" checkbox selected. The brand facet is left out. |
$brands_url, $breadcrumbs | The overview's address and breadcrumbs (Brands and the brand). |
Sorting is controlled by ?sort= with " sold," " price," " alphabetic," or "created " and ?sort_order=asc or desc. Alphabetical sorting is always A–Z. The store sets $canonical and $noindex itself (a selected filter, a brand with few items, or noindex on the brand). $meta_title, $open_graph_title, and $open_graph_description are set only when the store owner has filled them in, and $meta_description is the brand’s description or the beginning of the introduction. Therefore, build the title yourself based on $brand->getName(), just as you do for the categories (see Montana’s brand.html).
<{if $brand->getImage()}>
<img src="<{$brand->getImage()->getSrc(320, 200, 'fit')}>" alt="<{$brand->getImageAlt()|escape}>">
<{/if}>
<h1><{$brand->getName()|escape}></h1>
<{$brand->getDescriptionA()}>
<{foreach $products as $product}>
...
<{/foreach}>
<{if $pager}>
<{$pager->render()}>
<{/if}>
<{if $brand->getDescriptionB()}>
<div id="brand-text"><{$brand->getDescriptionB()}></div>
<{/if}>
The Brand object has the following methods:
| Method | Returns |
|---|---|
getName(), getBrandId() | Name and ID. |
getImage(), getImageAlt() | The logo and the alt text (the image description, or the brand name). |
getRemoteUrl() | The page from "Link to," otherwise the brand page, otherwise false. |
getBrandPageUrl(), getLinkToUrl() | Only the brand page, or only the page from "Link to." Both return false when there is none. |
getRewriteUrl() | The address after /brands/. |
getDescriptionA(), getDescriptionB() | Introduction (above the products) and body text (below the products) in HTML, translated into the local language. |
getMetaTitle(), getMetaDescription(), getOpenGraphTitle(), getOpenGraphDescription() | The brand's own SEO fields. These are blank if the shop owner hasn't filled them out. |
getWebsite() | The brand's own website. To be used as sameAs in structured data, not as a link in the online store. |
getProductCount() | Number of items the customer can see. |
getBestsellers(5) | The brand's best-selling items. |
Use $webshop->getBrands(true) to display a list of brands with products elsewhere in the theme, such as in the footer. Montana is a good starting point: see brands.html, brand.html, and partials/schema.brand.html. A headless theme fetches the pages through the headless API (brand_list and brand).
Pages
Static pages contain a $page.
Blog
The blog can be divided into two pages: blog.html and blog_post.html, where the first can retrieve a
list of blog posts via:
<{$blog_posts = $webshop->getBlogPosts()}>
Individual blog posts are displayed by looking at the variable $blog_post.
If the list of blog posts comes from a category, a $category with that category is also present.
Product reviews
In product_review.html, you have access to $order, which is the customer’s order. You can only review
products you have purchased. Based on the order, you can retrieve the products using $order->getReviewProducts(), which returns each item once, even if it appears on multiple order lines (e.g., in two colors). The fields are named after the item’s ID, so using $order->getOrderProducts() would cause the empty fields on the last line to overwrite the customer’s responses. To save
the product reviews, you must make a POST request to the same page with the following content:
<{if $order}>
<{if $get.voted}>
Tak!
<{else}>
<form action="" method="post" enctype="multipart/form-data">
<{foreach $order->getReviewProducts() as $product}>
<{$product->getName()|escape}>
Stjerner:
<input type="number" min="1" max="5" name="rating[<{$product->getProductId()}>]">
Anmeldelse
<textarea name="description[<{$product->getProductId()}>]"></textarea>
Billeder (valgfrit)
<input type="file" multiple accept="image/jpeg,image/png,image/webp,image/gif" name="review_images[<{$product->getProductId()}>][]">
<{/foreach}>
<input type="submit" value="Skriv anmeldelse"/>
</form>
<{/if}>
<{/if}>
$get.voted is true when the customer has submitted a review.
The customer can attach up to 5 images per item in the ` review_images[item_id][]` field. The form must have ` enctype="multipart/form-data"`. The images must be JPEG, PNG, WebP, or GIF files no larger than 10 MB, and the item must have a rating from 1 to 5. If one or more images could not be saved, $get.images_failed contains the number. If the entire submission was too large for the server, the customer is redirected back to the form with $get.review_error set to too_large. Phone images take up a lot of space, so the built-in themes scale them down in the browser before the form is submitted.
The images are displayed using $review->getImages(), which returns a list of images. The list is empty until the review is approved, and if the store has disabled the display of images for that review:
<{foreach $product->getProductReviews() as $review}>
<p><{$review->getDescription()|escape}></p>
<{foreach $review->getImages() as $image}>
<a href="<{$image->getSrc(1600, 1600)}>">
<img src="<{$image->getSrc(160, 160, 'box')}>" alt="" loading="lazy">
</a>
<{/foreach}>
<{/foreach}>
To link to the review page from an order, use $order->getReviewUrl().
Search
The search works by making a GET request to /search, where the argument
?search= must be your search term. For example:
<form action="/search">
<input type="text" name="search" value="<{$get.search|escape}>"/>
<input type="submit" value="Søg"/>
</form>
Searches are performed across products, categories, blog posts, and landing pages. To display the results, you must therefore check the following variables:
$products, $categories, $blog_posts, $pages, and $landing_pages.
Searching static pages must be enabled in admin.
Page numbers on the search page
The search fetches up to 250 products, sorted by relevance and optionally with in-stock products first. Without page numbers they are all in $products on one page. To split them into pages, the theme must set search_pager at the top level of theme_settings.json and show $pager below the products in search.html:
{
"info": "Mit tema",
"search_pager": true
}
<{if $pager}>
<{$pages = $pager->render()}>
<{if $pages}>
<nav class="pagination"><{$pages}></nav>
<{/if}>
<{/if}>
With the flag, the search page shows as many products per page as the categories, that is, the shop owner's Products per category page under Design → Search and display. $pager->render() gives the same links as on the category page, and they keep the search term, the category and property selections, and the customer's choices in the product filter. Pages count from 0 with ?p= as on the categories, and a page after the last one returns 404.
With page numbers, only the current page is in $products, so $products|count is no longer the number of products found. Use $product_count for that. $count also counts the categories, landing pages, blog posts, and pages found.
Never set the flag without showing $pager, or customers cannot get past the first page. All of Shoporama's built-in themes with a search page have the flag. Your own copies of the themes made before November 30, 2026 do not, and still show all products on one page until you add the flag and the pager yourself.
The address can ask for a different number of products with ?maxp=, e.g. maxp=100. The default is 250, and at most 1000 are fetched.
Wish List
If your customers can log in to your store, you can let them create wish lists. They can create as many wish lists as they want, and each wish list has a name, a description, and a list of products. The wish list itself has a public URL so your customers can share a link.
The wishlist uses the following templates:
wishlist.html
/wishlist
The page with the public wishlist.
$wishlist, which contains the wishlist. See the methods here.
user-wishlists.html
/user-wishlists
The page with the user's wishlists. Requires login.
$customer->getWishlists() to fetch the wishlists.
user-wishlist.html
/user-wishlist
The page used to edit the wishlist and its products
$wishlist, which contains the wishlist. See the methods here.
To create a wish list, send a POST request from user-wishlists.html with the name field and
an optional description field. For example:
<form action="" method="post">
Navn
<input type="text" name="name">
Beskrivelse
<textarea name="description"></textarea>
<input type="submit" value="Opret">
</form>
Please note that you can use the methods $wishlist->getRemoteUrl() and $wishlist->getEditUrl() to
create links for viewing and editing wish lists.
In the user-wishlist.html file, where the wish list is edited, the name and description must be sent as
name, description, and status, which can be either active or closed.
The products themselves, their quantities, and any comments must be sent as an array in the following format:
wishlist_product[{id}][name] = 'navn'
wishlist_product[{id}][comments] = 'kommentar'
wishlist_product[{id}][remove] = '1' // kun hvis produktet skal fjernes
Example code:
<{foreach $wishlist->getWishlistProducts() as $wp}>
<{* Fordi der er forskel på produkter og ønskelisteprodukter }*>
<{$product = $wp->getProduct()}>
<input type="checkbox" name="wishlist_product[<{$wp->getWishlistProductId()}>][remove]" value="1">
<a href="<{$product->getUrl()|escape}>"><{$product->getName()|escape}></a>
<{if $variant = $wp->getVariantValue()}>
<{$wp->getVariantName()|escape}>: <{$variant|escape}>
<{/if}>
<input type="number" name="wishlist_product[<{$wp->getWishlistProductId()}>][amount]" value="<{$wp->getAmount()}>">
<textarea name="wishlist_product[<{$wp->getWishlistProductId()}>][comments]"><{$wp->getComments()|escape}></textarea>
<{/foreach}>
If a variable named edit is submitted, the page will return to the same edit page. Otherwise,
the user will be redirected to the wish list overview. To delete the wish list, a variable named
remove must be submitted. For example:
<input type="submit" name="remove" value="Slet" onclick="return confirm('Er du sikker?');">
To add products to a wish list from the store, you can make a POST request from any page using the fields
wishlist_id, product_id, and an optional attribute_value_id if the product has variants.
Example:
<{if $product && $customer}>
<{if $wishlists = $customer->getWishlists()}>
<form action="" method="post">
<input type="hidden" name="product_id" value="<{$product->getProductId()}>"/>
<label>Vælg ønskeliste:</label>
<select name="wishlist_id">
<{foreach $wishlists as $wishlist}>
<option value="<{$wishlist->getWishlistId()}>">
<{$wishlist->getName()|escape}>
</option>
<{/foreach}>
</select>
<{if $variant = $product->getVariant()}>
<label>Vælg variant:</label>
<select name="attribute_value_id">
<{foreach $variant->getValues() as $value}>
<option value="<{$value->getAttributeValueId()}>">
<{$variant->getName()|escape}>: <{$value->getVal()|escape}>
</option>
<{/foreach}>
</select>
<{/if}>
<input type="submit" value="Tilføj til ønskeliste">
</form>
<{/if}>
<{/if}>
Return center
The return center lets your customers create returns on their own. It must be enabled in the store settings. Once a customer has created a return, it must be approved in the admin panel, and a credit note will be generated.
The return center uses the following templates:
return.html
Template: return.html
/return
The page where the return is created
Relevant variables:
$order, which contains the order the customer wants to return. See the methods here.
$offer_store_credit is set (1) if the store owner offers store credit instead of a refund. In that case, show a field <input type="checkbox" name="return_as_credit" value="1"> where the customer can choose store credit for the entire return. $credit_free_label is set (1) if store credit also comes with a free return label — use it to show a suitable text next to the option.
$offer_exchange is set (1) if the store owner offers exchanges. In that case, show a button <button type="submit" name="exchange" value="1" formnovalidate> that takes the customer on to the exchange wizard at /return-exchange (template return-exchange.html). Use the same return[$line] checkboxes to select products as for a regular return.
$offer_exchange also becomes 0 if the shop owner has turned on Only one exchange per order under Orders → Return center, and the order is already part of an exchange chain. The theme must therefore ALWAYS gate the exchange button on $offer_exchange and never hardcode it. Otherwise the customer sees a button that is rejected server-side. If you want to show an explanation instead of the button, use $order->hasExchange() (the order is part of an exchange chain) and $order->isExchangeOrder() (the order IS the result of an exchange). Check isExchangeOrder() FIRST, since both are true on an exchange order:
<{if $offer_exchange}>
<button type="submit" name="exchange" value="1" formnovalidate>Ombyt valgte</button>
<{elseif $order->isExchangeOrder()}>
<p>Denne ordre er allerede en ombytning, og der kan kun byttes én gang.</p>
<{elseif $order->hasExchange()}>
<p>Du har allerede oprettet en ombytning på denne ordre.</p>
<{/if}>
Regular returns are unaffected by the setting, so the return button must always be shown.
The wizard return-exchange.html receives $order, $return_value (for live calculation), and $exchange_lines (an array per unit with line, order_product_id, name, product_id, attribute_name, and variants with attribute_value_id/name/cnt/effective_price). It posts confirm=1, op[$line], exchange_product[$line], and exchange_attr[$line][$attribute_id] (+ optional refund_surplus). Search via /ajax_search?include_variants=1&term=.... Write the interactivity in plain JavaScript (Alpine cannot be assumed to be loaded), and gate stock counts on $settings.product.show_stock_count. See Montana for reference.
$webshop->getReturnExchangeInstantPayment() is true when the store owner allows the customer to pay the price difference immediately. The customer is then redirected directly to pay the difference after confirmation. Otherwise, for a more expensive exchange, the customer receives a payment link for the full price of the new item, and the value of the returned item is refunded to the card. Use this to select the correct text in the wizard and in the return_exchange_received.html email.
order-return.html
Template: order-return.html
/order-return
The page where the return is shown afterwards
Relevant variables:
$order_return with the return. See the methods here.
$order_return->getOrder()->getGlsReturnQr() returns the path to the GLS return QR code image (or null if there is no QR code).
If the return is an exchange ($order_return->getExchange() = 1), show the exchange summary instead of the regular refund: getExchangeReturnValue() (return value), getExchangeTotal() (the new products), getExchangeDifference() (positive = the customer pays, negative = the customer gets money back), getRefundSurplus(), and getOrderReturnExchanges() (the requested new products, each with getProduct()/getAttributeLabels()/getUnitPrice()).
return_received.html
Template: return_received.html
Email sent to the customer when they create a return
Relevant variables:
$order_return with the return. See the methods here.
There are two ways for a customer to access the returns page. One is by entering the order number and email address
associated with their order. The other is by following a direct link. The direct link is retrieved from the order using
$order->getReturnUrl(). For example:
<{if $webshop->useReturnCenter() && !$order->getIsCreditNote()}>
<a href="<{$order->getReturnUrl()|escape}>">Retuner varer</a>
<{/if}>
As shown in the example, it’s a good idea to check that the order isn’t a credit note and to verify whether the online store has enabled
the return center. The example can be used anywhere there is an $order, e.g. in the customer’s own order summary or in emails.
If you do not use login, or for some other reason want customers to be able to look up their order, you must implement a search on return.html
using the order number and email address. The fields webshop_order_id and email must be
POSTed to /return. If the order is found, the customer is redirected to the return; if not,
$get.not_found will be set, and you can display an error message in the theme. A minimal form might look like this:
<{if $get.not_found}>
<p>Der blev ikke fundet nogen ordre.</p>
<{/if}>
<h1>Returcenter</h1>
<form method="post" action="">
<input type="number" name="webshop_order_id" placeholder="Ordrenummer">
<input type="email" name="email" placeholder="E-mail-adresse">
<input type="submit" value="Søg">
</form>
Creating a return
In the return.html file, a list of order lines must be displayed, and the customer can select which products to
return and, if applicable, why. Unlike standard order views, the returns list must contain one line per order line.
<form action="" method="post">
<{$line = 0}>
<!-- Looper ordrelinjerne igennem -->
<{foreach $order->getOrderProducts() as $product}>
<!-- getReturned() returnerer antallet der tidligere er returneret -->
<{$returned = $product->getReturned()}>
<!-- Løkke for hver antal -->
<{section name="i" loop=$product->getAmount()}>
<{$line = $line+1}>
<!-- Viser ikke flere end det er muligt at returnere -->
<{if $line - $returned > 0}>
<{$product->getName()|escape}>
<{if $attributes = $product->getAttributes()}>
<{foreach $attributes as $attribute}>
<{$attribute.name}>: <{$attribute.val}>
<{/foreach}>
<{/if}>
<!-- Check hvilken pris der skal vises -->
<{if $webshop->getUseCalculatedUnitPrice()}>
<{$webshop->getCurrency()}> <{$product->getCalculatedUnitPrice()|number_format:2:",":"."}>
<{else}>
<{$webshop->getCurrency()}> <{$product->getUnitPrice()|number_format:2:",":"."}>
<{/if}>
<!-- Checkbox og en grund -->
<input type="checkbox" name="return[<{$line}>]" value="<{$product->getOrderProductId()}>">Vælg
<input type="text" name="reason[<{$line}>]" placeholder="Evt. årsag til returnering"/>
<{/if}>
<{/section}>
<{/foreach}>
</form>
In the admin panel, you can specify a fixed shipping method and price. If this has been done, the shipping method is retrieved via
$webshop->getReturnShipping($country_id), and if the price is fixed, it is retrieved via
$webshop->getReturnShippingPrice($country_id). For example:
<{if $return_shipping = $webshop->getReturnShipping($order->getDelCountryId())}>
Varer skal returneres via <{$return_shipping->getName()|escape}>.
<{if $price = $webshop->getReturnShippingPrice($order->getDelCountryId())}>
Prisen er <{$price|number_format:2:",":"."}>
<{else}>
Prisen er <{$return_shipping->getCost()|number_format:2:",":"."}>
<{/if}>
<{else}>
<!-- Vis en liste over shoppens almindelige leveringsmetoder her -->
<{/if}>
If the customer can choose the shipping method, send the selected method as shipping_id.
Displaying the return
Once the return is created, it appears in order-return.html, which contains a $order_return
with the relevant methods.
Digital withdrawal
The digital withdrawal feature lives at /withdrawal and lets the customer
exercise their right of withdrawal online (a legal requirement under the Danish Consumer Contracts Act). It is a legal
declaration of intent (“I am withdrawing from order #1234”) and is separate from the return center, which handles the actual
return of goods. The feature works for all stores, but only themes that have a withdrawal.html
file can display it — if the file is missing, a standard 404 is returned.
The store can disable this feature in the theme settings via the boolean field
checkout.disable_withdrawal. If it is disabled, all "Withdraw from purchase" links are hidden
($order->isWithinWithdrawalPeriod() returns false), and the entire
/withdrawal route returns a 404.
The deadline is 14 days plus 3 days of shipping time from when the order was shipped or picked up. If the store
offers a longer right of withdrawal, the deadline can be extended using the string field checkout.withdrawal_days
(e.g., 90). Numbers less than 14 are ignored. $order->getWithdrawalDays() returns the
applicable deadline in days (at least 14), so you can display it in the text on the withdrawal page.
Flow and variables
The entire two-step flow is contained in a single file, withdrawal.html. The controller sets the variable
$step, which you use to branch the flow:
lookup— the customer arrived without a token and needs to find their order (the fieldswebshop_order_id+email)start— the order is shown together with an optional reason and a "Withdraw from purchase" button (POSTwithdraw=1)confirm— confirmation step with a "Confirm withdrawal" button (POSTconfirm=1)receipt— receipt after the withdrawal has been registeredexpired— the order is outside the withdrawal period (or canceled/credited) and can no longer be withdrawn from. The step is shown both when the customer opens an old link and when a POST attempt is rejected — so an outdated or tampered token URL cannot register a withdrawal after the deadline
In the start, confirm, receipt, and expired steps, you have access to
$order (a SafeOrder). In the lookup step,
you can display an error using $get.not_found. A reason entered by the customer is available in $reason.
<{if $step == "receipt"}>
<h1>Din fortrydelse er registreret</h1>
<p>Ordre #<{$order->getWebshopOrderId()}></p>
<{elseif $step == "confirm"}>
<form method="post">
<input type="hidden" name="reason" value="<{$reason|escape}>">
<button type="submit" name="confirm" value="1">Bekræft fortrydelse</button>
</form>
<{elseif $step == "start"}>
<form method="post">
<textarea name="reason"><{$reason|escape}></textarea>
<button type="submit" name="withdraw" value="1">Fortryd købet</button>
</form>
<{elseif $step == "expired"}>
<h1>Fortrydelsesfristen er udløbet</h1>
<p>Ordre #<{$order->getWebshopOrderId()}></p>
<{else}>
<!-- lookup: kunden finder sin ordre uden token -->
<form method="post">
<input type="text" name="webshop_order_id" required>
<input type="email" name="email" required>
<button type="submit">Fortsæt</button>
</form>
<{/if}>
Withdrawal link
Use $order->getWithdrawalUrl() to create a token link for a specific order (e.g., in
order.html or on the "My Account" page). The link works without logging in. If you want a general link
(e.g., in the footer), simply point to /withdrawal — this will take the customer to the lookup step.
<a href="<{$order->getWithdrawalUrl()|escape}>">Fortryd købet</a>
<!-- eller et generelt link, fx i footeren -->
<a href="/withdrawal">Fortryd købet</a>
Digital content
If the order contains digital content that the customer has already downloaded, the right of withdrawal for those
items may no longer apply. You can display an informational note on the confirm step using
$order->hasDownloadedDigitalContent() (returns true/false) — this
does not block the withdrawal, but informs the customer.
Receipt email
When the customer confirms, a receipt is sent via the email template mails/withdrawal_received.html
(durable medium, legal requirement). It has access to $order (SafeOrder), $reason, and
$withdrawal_time. If the template is missing, no receipt is sent — so remember to include it in the theme alongside
withdrawal.html itself.
Legal requirements for the theme (Danish Consumer Contracts Act, from June 19, 2026)
Shoporama's standard themes meet the requirements below. If you have your own theme that sells to consumers, you must add them yourself:
- Link on all pages (§ 20 a): The feature must be prominent and easily accessible throughout the entire period. Put a link to
/withdrawalin the footer, visible without having to expand anything. Hide it when$settings.checkout.disable_withdrawalis set. - Name, contract, and email (§ 20 a, subsection 2): Show
$order->getOrderName(),$order->getWebshopOrderId(), and$order->getEmail()("Receipt will be sent to") on thestartandconfirmsteps. The button onconfirmmust be labeled "Confirm withdrawal" or something equally unambiguous. - Exempt products before purchase (§ 8, subsection 1, no. 12): Show
$product->getWithdrawalExemptText()on the product page when$product->isWithdrawalExempt()is true, and list the exempt products in checkout based on$basket[i].product. - Digital content (§ 18, subsection 2, no. 13): If a product in the cart has
getWithdrawalExemptReason() == 'digital_content', the customer must tick a required checkbox giving consent and acknowledging that the right of withdrawal is lost. - The order confirmation (§ 13): List
$order->getWithdrawalExemptProducts()(an array withname,amount,reason, andtext) inmails/invoice.html, and preferably show the link$order->getWithdrawalUrl()when$order->isWithinWithdrawalPeriod()is true. - Where to find it, before purchase (§ 8, subsection 1, no. 11): State in checkout, e.g. where the customer accepts the terms and conditions, that the customer can withdraw online via the link in the footer or in the order confirmation.
<!-- produktside -->
<{if $product->isWithdrawalExempt()}>
<p class="notice"><{$product->getWithdrawalExemptText()|escape}></p>
<{/if}>
<!-- checkout, ved accept af handelsbetingelser -->
<{$has_digital_content = false}>
<{section name="w" loop=$basket}>
<{if $basket[w].product && $basket[w].product->isWithdrawalExempt()}>
<p><{$basket[w].product->getName()|escape}>: <{$basket[w].product->getWithdrawalExemptText()|escape}></p>
<{if $basket[w].product->getWithdrawalExemptReason() == 'digital_content'}><{$has_digital_content = true}><{/if}>
<{/if}>
<{/section}>
<{if $has_digital_content}>
<label><input type="checkbox" name="digital_content_consent" value="1" required>
Jeg giver samtykke til, at leveringen af det digitale indhold begynder med det samme, og jeg anerkender, at jeg dermed mister min fortrydelsesret.</label>
<{/if}>
/also
also.html is our upsell page. By default, you have access to $product, and based on that,
you can make suggestions to the customer. For example, it might be useful to use $product->getRelatedProducts(),
$product->getAlsoBought(), or $webshop->getPopularProducts().
404
Only used to display 404 pages.
410
Only used to display 410 pages.
Captcha
A CAPTCHA is automatically displayed when you try to subscribe to the newsletter or post comments. This is to prevent
spam. You can design the CAPTCHA page yourself in captcha.html, and it must contain at least the following:
<form action="" method="post">
<{$form}>
<{if $error}>Fejl i koden<{/if}>
<img src="<{$imgstr}>">
Skriv indholdet at ovenstående felt:
<input type="text" name="c">
<input type="submit" value="OK">
</form>
Newsletter sign-up
Any form in the store that is submitted via POST and includes an email address and the mailing list set to 1
subscribes the customer to the store’s newsletter. This applies, for example, to the checkout page (address.html), profile creation (user-sign-up.html),
"Notify me when this item is in stock," and a sign-up form at the bottom of the page. The sign-up is sent to the newsletter service the shop has
set up (e.g., Klaviyo, Mailchimp, or Brevo), or to Shoporama’s own newsletter. At the same time, consent is stored along with the time and IP address.
Always use a checkbox that the customer checks themselves, so that the registration is based on active consent:
<label>
<input type="checkbox" name="mailinglist" value="1">
Tilmeld mig nyhedsbrevet
</label>
Log In
It is possible to allow customers to log in to the store. If a user is logged in, there will be a
$customer variable containing information about the user. All pages that allow editing, logging in, etc., must
submit data via POST to the page itself.
/user-edit.html
Used to edit the customer's details. You can add fields to the customer. See more below this table.
company
vat_number
name
email
phone
address
zipcode
city
country_id
pass1
pass2
/user-orders.html
The customer's previous orders
$my_orders
/user-points.html
The customer's points
$my_points
/user-profile.html
Displays the customer's details
$customer
/user-reset-password.html
Used to reset the password
email
password
/user-sign-in.html
The login page. Use redir if the customer should be sent on to a URL after logging in.
email
password
redir
/user-sign-up.html
A form the customer uses to register.
If mailinglist is set to 1, the customer is also subscribed to the store's newsletter. Use a checkbox so the customer gives consent themselves. See Newsletter sign-up.
name
email
phone
address
zipcode
city
company
vat_number
country_id
mailinglist
Custom customer fields
In admin you can define your own fields for your users. These fields are edited as follows:
<{foreach $webshop->getCustomerFields() as $field}>
<{if $field->getType() == "list"}>
<{$field->getName()|escape}>
<select name="field[<{$field->getCustomerFieldId()}>]">
<{foreach $field->getValues() as $value}>
<option <{if $field->getVal() == $value}>selected="selected"<{/if}> value="<{$value|escape}>">
<{$value|escape}>
</option>
<{/foreach}>
</select>
<{elseif $field->getType() == "string"}>
<{$field->getName()|escape}>
<input type="text" name="field[<{$field->getCustomerFieldId()}>]" value="<{$field->getVal()|escape}>">
<{/if}>
<{/foreach}>
Loyalty program
The loyalty program allows your customers to earn and redeem points when they place orders. The setup is managed under Customers > Loyalty Program.
You can use the methods below to check whether the store has activated the loyalty program, whether the customer is logged in, and whether they have earned points they can use:
<{if $webshop->hasLoyaltyProgram() && $customer && $customer->getActivePoints()}>
[Visning af point m.m.]
<{/if}>
To show how many points the customer has earned, as well as how many they can use on the current order, you can use the following code example:
Du har optjent <{$customer->getActivePoints()|number_format:0:",":"."}> point.
<{if $points = $customer->getPointsAvailable()}>
Du kan bruge <{$points|number_format:0:",":"."}> point på denne ordre.
<{else}>
Du har ingen optjente point du kan bruge på denne ordre.
<{/if}>
The field you POST to the cart that specifies how many points the customer wants to use must be named use_points and can
look like this:
<input type="number" name="use_points" value="<{$use_points}>" min="0" max="<{$customer->getPointsAvailable()}>"/>
You can use $earns to see how many points the customer earns on the order:
Du optjener <{$earns|number_format:0:",":"."}> point på denne ordre.
You can use the example below if you want to describe your loyalty program:
Du optjener <{$webshop->getLoyaltyProgramBasePoints()|number_format:0:",":"."}> point hver
gang du køber for 1 <{$webshop->getCurrency()}>. Når du betaler med point svarer
<{$webshop->getLoyaltyProgramBaseCost()|number_format:0:",":"."}> point til 1 <{$webshop->getCurrency()}>.
If you want to create a page with a points overview, you can use user-points.html, where you can loop through $my_points
and display the content. Take a look at the SafePoint class to see which methods are available.
Tip: you can style your order overview using the following CSS classes: points_used, points_earned, and has_profile.
Checkout
Simply put, the checkout flow is a series of HTML pages, each of which contains a form that POSTs
some data to itself, and if the next field is set, Shoporama will redirect to the next page in the flow. Typically,
you would set the “Next” button to name="next". You can always link to previous pages in the flow. Once the customer has
entered their information, it is stored in two arrays: $session_order and $session_del. For example,
$session_order.name.
basket.html
File Name: basket.html
Shows the contents of the cart. A simple example of how $basket is used:
<{foreach $basket as $line}>
<{$line.amount}> x <{$line.product->getName()}>
<{foreach $line.attributes as $a}>
<{$a.name|escape}>: <{$a.value|escape}>
<{/foreach}>
<{/foreach}>
To change the quantity, POST it like this:
[...]
<input name="amount[<{$line.id}>]" value="<{$line.amount}>" />
[...]
To add a discount code, POST a voucher with the discount code. If the discount code is invalid, $get.wrong_voucher will be present in the template.
The delivery country can be changed by POSTing a del_country_id with the ID of the delivery country.
If the customer is sent back to the cart from a later checkout step, $get.check_fail is set. The built-in themes only show a neutral message when check_fail == "1" (the cart could not be validated). Keep any message generic, e.g. "Something went wrong, please try again", and never reveal to the customer why a purchase was stopped: some rejections are deliberately silent for fraud protection (e.g. blacklist). So don't distinguish between the individual values of check_fail in customer-facing text.
Relevant variables/parameters in the form:
$basket
$voucher
$voucher_discount
$campaign_ids
$campaign_discount
$price
$shipping_price
$total_price
$vat
address.html
File Name: address.html
The page where the customer enters their delivery details.
If mailinglist is set to 1, the customer is subscribed to the newsletter.
If create_profile is set to 1, a profile is created for the customer so they can log in later.
Suggested Addresses (Denmark)
The built-in themes can suggest Danish addresses from the Danish Address Register as the customer types, and fill in the ZIP code and city (the theme setting checkout_address.enable_address_autocomplete). You can use the same component in your own theme. It finds the fields order_address, order_zipcode, order_city, and order_country_id and the matching del_ fields for the delivery address on its own, by id or name:
<{if $settings.checkout_address.enable_address_autocomplete}>
<script src="/javascript/dk-address.js?v=4" defer></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
if (window.ShoporamaDkAddress) {
// countryCode: butikkens standardland, når der ikke er noget landefelt
ShoporamaDkAddress.attachCheckout({ countryCode: 'DK', label: 'Adresseforslag' });
}
});
</script>
<{/if}>
You add the setting to the checkout_address group in theme_settings.json. Without default, it is off until the store owner turns it on:
{
"path": "enable_address_autocomplete",
"name": "Aktivér adresseforslag (Danmark)",
"description": "Foreslår adresser fra Danmarks Adresseregister, mens kunden skriver sin adresse.",
"type": "bool"
}
The suggestions are only shown when the country is Denmark. The country is read from data-countrycode on the selected option in the country field, so add it to your options. countryCode is used when there is no country field, e.g. in a store with only one country:
<option value="<{$countries[i]->getCountryId()}>" data-countrycode="<{$countries[i]->getCode()|escape}>">
<{$countries[i]->getName()|escape}>
</option>
If your fields have different names, use ShoporamaDkAddress.attach() with the fields and country fields in order of priority. The component sends input and change events when it populates the fields, so that Alpine (x-model) and your own scripts are updated. The appearance is controlled by the CSS variables --dk-address-bg, --dk-address-text, --dk-address-border, --dk-address-active-bg, and --dk-address-radius. Do not call the address service directly from the theme: when it is made user-controlled, Shoporama changes the access key in one place.
ShoporamaDkAddress.attach({
input: 'billing_street', // id eller element
zip: 'billing_zip',
city: 'billing_city',
countries: ['billing_country'], // landefelter (select) i prioriteret rækkefølge
countryCode: 'DK', // når intet landefelt har en værdi
label: 'Adresseforslag' // aria-label på listen
});
Relevant variables/parameters in the form:
order_country_id
order_name
order_company_name
vat_number
ean_number
order_address
order_zipcode
order_city
email
phone
comments
del_name
del_company_name
del_address
del_zipcode
del_city
del_country_id
mailinglist
create_profile
shipping.html
File Name: shipping.html
Used to select a shipping method.
The individual shipping methods can be retrieved using $webshop->getShippings().
To save a shipping method, POST a shipping_id with the ID of that shipping method. If the shipping method has parcel shops, you can retrieve them using $shipping->getDeliveryShops(). You can select a parcel shop as follows:
[...]
<{if $shipping->getModule()}>
<select name="shop">
<{foreach $shipping->getDeliveryShops() as $shop}>
<option value="<{$shop.number}>">
<{$shop.name|escape}>
<{$shop.street|escape}>
<{$shop.zip|escape}>
<{$shop.city|escape}>
</option>
<{/foreach}>
</select>
<{/if}>
[...]
Relevant variables/parameters in the form:
shipping_id
shop
approve.html
File Name: approve.html
Confirmation page. Used to display the order.
If the store has multiple payment gateways, they can be selected on this page. They are retrieved via $webshop->getPaymentGateways() and submitted via payment_gateway_id to switch between them.
Relevant variables/parameters in the form:
$basket
$shipping
payment_gateway_id
thanks.html
File Name: thanks.html
The thank-you page. Used to show the completed order.
Relevant variables/parameters in the form:
$order
Vipps MobilePay Express
If the store offers Vipps MobilePay as a payment method, it can display an "Express" button in the cart (the customer purchases the entire cart and selects the address and delivery options in the app) and a "Buy Now" button on the product page (only the item on that page; the cart remains unchanged). Shoporama automatically inserts the button scripts into the shopping cart and product page when the buttons are enabled under the payment method. The theme only needs to determine where the button is placed.
The built-in themes have fixed positions. In other themes, the script places the button below the checkout button or the “Add to Cart” button, and the store owner can specify a CSS selector under the payment method. If you want to determine the placement yourself, insert an empty element:
<!-- Kurven: under kasseknappen -->
<div data-vipps-express data-stretched="true" hidden></div>
<!-- Produktsiden: inde i formularen med product_id -->
<div data-vipps-express="product" data-stretched="true" hidden></div>
The"hidden"attribute is removed by the script when the button is rendered. Without Express, the element remains hidden and takes up no space.data-stretched="true"sets the full width,data-rounded="true"rounds the corners, anddata-align="start|center|end"positions a narrow button.- The button is rendered in every placeholder, so you can have one for mobile and one for desktop and hide them with CSS.
- "Buy Now" submits the fields of the form the placeholder is in (variant, quantity, customer fields). A placeholder in a form for another product (e.g. related products) is skipped.
- The button is Vipps MobilePay's own, and the branding and language are determined by the sales unit. It cannot be customized beyond the attributes listed above.
Themes that render the pages in the browser
If the theme renders the pages using JavaScript (like Washington), insert <{$webshop->getVippsExpressScript()}> before </body> on all pages. The buttons are only inserted where the theme has a placeholder and are reinserted when the page changes. If the product page has no form, the theme can pass the product with a function:
window.vippsExpressProductData = function (holder) {
return { product_id: 1234, amount: 1, attributes: { 56: 789 } };
};
AI assistants in the browser (WebMCP)
Shoporama automatically adds tools for AI assistants in the browser to all stores and all themes (WebMCP). An assistant can search products, view a product, add to the cart, edit the cart, and send the customer to checkout. The theme does not need to do anything for the tools to work. The store owner can turn it off under Integrations → Sell through AI.
The only thing the theme should do is update the mini cart when the assistant has changed the cart. Shoporama then fires the event shoporama:basket-updated on document:
document.addEventListener('shoporama:basket-updated', function (e) {
// e.detail.cart: kurven efter ændringen
// lines: [{ line_id, product_id, name, variant, amount, unit_price, subtotal, url, in_stock }]
// item_count, subtotal, shipping, total, currency, prices_include_vat, version
// has_discount_code, discount og campaign_discount, når de findes
// e.detail.refetch(): henter den aktuelle side igen og giver HTML'en (Promise)
// På kurvsiden genindlæser Shoporama selv siden. Lad den gøre det.
if (/\/basket\/?$/.test(location.pathname)) {
return;
}
e.preventDefault(); // temaet opdaterer selv minikurven
document.querySelectorAll('[data-cart-count]').forEach(function (el) {
el.textContent = e.detail.cart.item_count;
});
});
- Call
e.preventDefault()when the theme has updated the mini cart itself. Otherwise Shoporama reloads the cart page, and on other pages nothing happens unless the theme haswindow.replaceFragments(themes built on Delaware). - The cart never includes the customer's details, the discount code, or stock levels. Prices are incl. VAT in the country's currency.
- The event is fired on
documentand does not bubble, so do not listen onwindow. Calle.preventDefault()synchronously, before anyawait. It is only fired in browsers with WebMCP, so test in Chrome with the flagchrome://flags/#enable-webmcp-testing. e.detail.refetch()fetches the page with the headerX-Shoporama-Refresh: cart, so it does not count as a page view (no view_basket webhook and no Facebook events). Use it if the mini cart is rendered on the server, and swap in the elements from the fetched HTML.- The built-in themes Montana, Delaware, DelawareDK, Washington, Alaska2, and California already listen.
Variant from the URL
If the assistant shows a specific variant, the product page opens with #webmcp-variant=<attribute_id>:<value_id> (multiple pairs separated by commas). Shoporama selects the variant via the field [name="attributes[ID]"] (select, radio button, or hidden field), a button with data-value-id in the same form, or Washington's data-variant-group/data-variant-value and select[data-variant-attribute]. If your theme uses something else, the variant is not selected automatically.
Themes with a login wall
If the theme requires login to view the store (like MontanaB2B), set "login_wall": true at the top of theme_settings.json. Shoporama then turns off the tools, and assistants cannot see the catalog and prices behind the wall. Your own copies of MontanaB2B without the flag are also recognized by the login wall in the theme's templates/index.html.
The tools
Shoporama registers these tools in all stores. The names are the same everywhere, and the theme doesn't need to do anything to get them.
| Tool | What it does | Changes the cart |
|---|---|---|
search_catalog | Searches the products and returns the name, price incl. VAT, currency, stock status (in_stock, backorder, or out_of_stock), and product_id. | No |
browse_store | Top categories and brands, or a category's subcategories and products. | No |
get_product | One product with description, price, stock status, variants with price and status, and fields the customer has to fill in. | No |
show_variant | Opens the product page with a variant selected (see Variant from the URL). | No |
get_cart | The cart with lines, prices, shipping, total, and version. | No |
create_cart | Adds products to an empty cart. | Yes |
update_cart | Sets the cart to exactly the lines the assistant sends, with absolute quantities and the cart's version. | Yes |
cancel_cart | Empties the cart. | Yes |
proceed_to_checkout | Opens the cart and checkout in the same tab. The customer fills in their details and pays. | No |
manage_orders | Opens the customer's order history. The customer logs in themselves. | No |
ask_business | Facts for questions about shipping, returns, payment, contact details, and terms, based on the store's own setup and llms.txt. | No |
get_ucp_profile | The store's UCP profile. Only when agentic commerce is turned on. | No |
No tool can pay, redeem discount codes, or give out the customer's details or stock levels.
Free shipping: progress bar and suggestions
In the shopping cart and during checkout, the theme can show how much more the customer needs to spend to qualify for free shipping—using a progress bar that fills up—and suggest items that can be added to the cart with a single click. Shoporama calculates the figures using the same rules as the checkout page and selects the suggestions. The theme simply displays them.
The built-in themes have these features behind two theme settings, both of which are disabled by default: checkout_cart.enable_free_shipping_bar and checkout_cart.enable_free_shipping_suggestions (in Alaska2 and California, they are in the checkout group). A custom theme does not get them automatically, but you can build them in using the variable and the two methods below.
Amount needed for free shipping: $free_shipping_progress
$free_shipping_progress is set on all pages in the online store. $webshop->getFreeShippingProgress() returns the same value even on pages where the variable is not set. It is null when there is nothing to display:
- The cart is empty, or it only contains add-ons,
- there is no free shipping threshold ("Free shipping above") on the delivery country or the shipping method,
- the shipping method has "Never free shipping," or
- an item in the cart has "Never free shipping."
Otherwise, it is an array with these fields:
| Field | Content |
|---|---|
limit | The limit for the delivery country or the selected shipping method, in the country's currency. The shipping method's own limit takes precedence. Until the customer selects a shipping method, the store's default method for that country is used, as shown at checkout. |
price | The amount measured against the threshold: the cart price after discounts. Add-ons that are exempt from the threshold do not count. The discount from a discount code with "Do not count toward the free shipping threshold" (e.g. gift cards) is not deducted, and the value of points used is deducted. |
remaining | The remaining amount: 0 when free shipping is reached. |
percent | An integer from 0 to 100 for the width of the bar. At most 99 until free shipping is reached. |
reached | True when the cart is over the threshold, or when a discount code or the loyalty program gives free shipping. In that case, price can be below limit. |
Checkout requires the cart to be over the threshold. A cart of exactly DKK 499 with a threshold of DKK 499 pays shipping, and remaining is 0.01. So never compare price and limit yourself; use reached and remaining so the theme always says the same as checkout.
Suggestions: $webshop->getFreeShippingSuggestions()
$webshop->getFreeShippingSuggestions($limit) returns items that qualify for free shipping or bring the customer closer to qualifying. $limit is 3 by default and cannot exceed 12. The method reads the cart itself, and the result is cached for the remainder of the page view. The list is empty when free shipping is reached or when $free_shipping_progress is null. Each element is an array:
| Field | Content |
|---|---|
product | The item, a product object just like everywhere else (getName(), getRemoteUrl(), getImage(), etc.). |
price | The unit price incl. VAT that the customer pays, with customer group, country, and currency, and a campaign on a single item included. |
reaches | True, when the item alone qualifies for free shipping. For example, display a label that says "Free Shipping." |
attribute | The variant attribute (getAttributeId(), getName()), or null if the item has no variants. |
values | The variant values that can be purchased (getAttributeValueId(), getVal()): values in stock, or all if the item can be sold on backorder. Empty if there are no variants. |
The order is fixed: first, items that are often purchased together with the items in the cart; next, the best-sellers in the same category; and finally, the store’s best-sellers. If none of these items alone qualify for free shipping, the system continues searching within the price range among items in the main category of the items in the cart and, finally, throughout the entire store, including non-sale items (only those that qualify for free shipping, with the cheapest listed first). Items that qualify for free shipping on their own are listed first, and items that are significantly more expensive than the remaining balance are filtered out. The list never includes items already in the cart, sold-out items, items marked “Never Free Shipping,” add-ons, gift cards, bundle deals, or items requiring customer input. Therefore, each item can be added to the cart with a single click.
Add to Cart
Each suggestion is its own small form that sends a POST request to / with these fields:
product_idandamount= 1.attributes[attribute-id]= value-id, when the item has variants. If it has only one purchasable value, you can send it as a hidden field; otherwise, send it as a drop-down list marked asrequired.redirect=/basketor/shipping, so the customer returns to the same step. This also applies when the store uses server-side tracking: the customer returns to the step with the tracking parameters in the URL, and the theme should not alter those parameters.
Example: component
A complete component built like the built-in themes. Place it, for example, in components/free-shipping.html:
<{* components/free-shipping.html: fri fragt, bjælke og forslag.
Inkludér den ALDRIG inde i en anden <form>.
Parametre: $show_bar, $show_suggestions, $return (/basket eller /shipping) *}>
<{if $free_shipping_progress && ($show_bar || $show_suggestions)}>
<{$fs = $free_shipping_progress}>
<{$fs_decimal = $webshop->getDecimalSeparator()}>
<{$fs_thousand = $webshop->getThousandSeparator()}>
<{$fs_currency = $webshop->getCurrency()}>
<{$fs_suggestions = []}>
<{if $show_suggestions && !$fs.reached}>
<{$fs_suggestions = $webshop->getFreeShippingSuggestions(3)}>
<{/if}>
<div class="free-shipping">
<{if $fs.reached}>
<p><{t}>Du har fri fragt<{/t}></p>
<{else}>
<{$fs_amount = $fs.remaining|number_format:2:$fs_decimal:$fs_thousand}>
<p><{t x=$fs_amount y=$fs_currency}>Du mangler {x} {y} for at få fri fragt<{/t}></p>
<{/if}>
<{if $show_bar}>
<div class="free-shipping__bar" role="progressbar" aria-valuenow="<{$fs.percent}>" aria-valuemin="0" aria-valuemax="100" aria-label="<{t}>Fri fragt<{/t}>">
<div class="free-shipping__fill" style="width: <{$fs.percent}>%"></div>
</div>
<{/if}>
<{if $fs_suggestions}>
<p><{t}>Forslag til fri fragt<{/t}></p>
<ul>
<{foreach $fs_suggestions as $fs_item}>
<{$fs_product = $fs_item.product}>
<li>
<{* Én formular pr. vare *}>
<form action="/" method="post">
<input type="hidden" name="product_id" value="<{$fs_product->getProductId()}>">
<input type="hidden" name="amount" value="1">
<input type="hidden" name="redirect" value="<{$return|default:'/basket'|escape}>">
<{$fs_image = $fs_product->getImage()}>
<{if $fs_image}>
<img src="<{$fs_image->getSrc(112, 112, 'fit')}>" alt="" width="56" height="56" loading="lazy">
<{/if}>
<a href="<{$fs_product->getRemoteUrl()}>"><{$fs_product->getName()|escape}></a>
<span><{$fs_item.price|number_format:2:$fs_decimal:$fs_thousand}> <{$fs_currency|escape}></span>
<{if $fs_item.reaches}>
<span class="free-shipping__badge"><{t}>Giver fri fragt<{/t}></span>
<{/if}>
<{* Variantvalg: kun købbare værdier. Én værdi sendes som skjult felt *}>
<{if $fs_item.attribute}>
<{if $fs_item.values|@count == 1}>
<input type="hidden" name="attributes[<{$fs_item.attribute->getAttributeId()}>]" value="<{$fs_item.values[0]->getAttributeValueId()}>">
<{else}>
<select name="attributes[<{$fs_item.attribute->getAttributeId()}>]" required aria-label="<{$fs_item.attribute->getName()|escape}>">
<option value=""><{t}>Vælg<{/t}> <{$fs_item.attribute->getName()|escape}></option>
<{foreach $fs_item.values as $fs_value}>
<option value="<{$fs_value->getAttributeValueId()}>"><{$fs_value->getVal()|escape}></option>
<{/foreach}>
</select>
<{/if}>
<{/if}>
<button type="submit" value="1"><{t}>Tilføj<{/t}></button>
</form>
</li>
<{/foreach}>
</ul>
<{/if}>
</div>
<{/if}>
The bar must have a height and a background specified in your stylesheet, for example:
.free-shipping__bar { height: 8px; margin-top: 12px; border-radius: 4px; background: #e8e8e8; overflow: hidden; }
.free-shipping__fill { height: 100%; border-radius: 4px; background: #111827; transition: width .3s; }
Include the component in basket.html and shipping.html, outside the step's own form:
<{* basket.html: før kurvens <form> *}>
<{if $settings.checkout_cart.enable_free_shipping_bar || $settings.checkout_cart.enable_free_shipping_suggestions}>
<{include file="components/free-shipping.html" show_bar=$settings.checkout_cart.enable_free_shipping_bar show_suggestions=$settings.checkout_cart.enable_free_shipping_suggestions return="/basket"}>
<{/if}>
<{* shipping.html: før trinnets <form>. Wrapperen står der altid, så den kan skiftes ud *}>
<{if $settings.checkout_cart.enable_free_shipping_bar || $settings.checkout_cart.enable_free_shipping_suggestions}>
<div id="checkout-free-shipping">
<{include file="components/free-shipping.html" show_bar=$settings.checkout_cart.enable_free_shipping_bar show_suggestions=$settings.checkout_cart.enable_free_shipping_suggestions return="/shipping"}>
</div>
<{/if}>
And add the two fields to the checkout_cart group in theme_settings.json, so they have the same names as in the built-in themes. Without default, they are off until the store owner turns them on:
{
"path": "checkout_cart",
"name": "Checkout: Kurv",
"description": "Kurvfunktioner.",
"fields": [
{
"path": "enable_free_shipping_bar",
"name": "Vis bjælke for fri fragt",
"description": "Viser i kurven og på leveringstrinnet, hvor meget kunden mangler for at få fri fragt.",
"type": "bool"
},
{
"path": "enable_free_shipping_suggestions",
"name": "Foreslå varer der giver fri fragt",
"description": "Foreslår op til 3 varer, der kan lægges i kurven med ét klik.",
"type": "bool"
}
]
}
Important notes
- A separate form for each item; never inside another form. HTML does not allow forms inside forms. The shopping cart and checkout page are typically one large form, so the card must appear before or after it.
- Null check. Always check
$free_shipping_progressbefore using the fields, and do not display anything if it isnull. - Only in the shopping cart and on the checkout page. The shopping cart and checkout page are never cached, so the map and suggestions can be rendered on the server and always match the customer’s shopping cart. Do not use them on product, category, or home pages: they may be stored in the shared page cache (e.g., in themes built on Montana), and then all visitors will see the first visitor’s numbers.
- Strictly speaking, use "
reached" and"remaining" instead of doing the math yourself (see above). - Changing the shipping method. The limit may depend on the shipping method. If your theme reloads the checkout step when the customer selects a different method, there’s nothing to do. If the theme saves the selection using AJAX, update the card based on the response. Leave the wrapper in place, even when the card is empty, so it can appear when the customer switches to a method with a limit:
// Leveringstrinnets formular uden "next": så gemmes valget, og siden sendes tilbage uden at gå videre
var data = new FormData(form);
data.delete('next');
fetch(window.location.pathname, { method: 'POST', body: data, credentials: 'same-origin' })
.then(function(response) { return response.text(); })
.then(function(html) {
var doc = new DOMParser().parseFromString(html, 'text/html');
var fresh = doc.getElementById('checkout-free-shipping');
var current = document.getElementById('checkout-free-shipping');
if (fresh && current) current.replaceWith(fresh);
});
- B2B. The threshold is calculated based on the cart total including VAT, as shown at checkout, and
the pricesin the suggestions include VAT. If the customer is purchasing without VAT (VAT number),$vatis 0, and the amount is calculated excluding VAT. If your theme displays prices excluding VAT, convert the item’s price for display, and only include “(incl. VAT)” next to the missing amount when the customer pays VAT:
<{* B2B: varens pris ekskl. moms, når resten af temaet viser det (kun visning) *}>
<{$fs_price = $fs_item.price}>
<{if $b2b}>
<{$fs_vat_factor = 1 + ($fs_product->getProductVat() / 100)}>
<{if $fs_vat_factor > 0}><{$fs_price = $fs_price / $fs_vat_factor}><{/if}>
<{/if}>
<span><{$fs_price|number_format:2:$fs_decimal:$fs_thousand}> <{$fs_currency|escape}></span>
<{* Det manglende beløb er inkl. moms, som i kassen. Uden moms ($vat 0) måles det uden moms *}>
<{t x=$fs_amount y=$fs_currency}>Du mangler {x} {y} for at få fri fragt<{/t}><{if $b2b && $vat > 0}> <{t}>(inkl. moms)<{/t}><{/if}>
- Older variables.
$free_shipping_limit(the threshold; 0 when there is none) and$free_shipping_price(the cart total excluding excluded add-ons) still exist and remain unchanged. They do not take into account gift cards, redeemed points, items marked "Never Free Shipping," free shipping from a discount code or the loyalty program, or the requirement that the cart total must exceed the threshold. Use$free_shipping_progressin new themes. - Montana is the reference. See
components/free-shipping.htmland the relevant sections inbasket.htmlandshipping.htmlin Montana. The replacement code for selecting a shipping method is located inpartials/checkout.shipping.methods.html.
Rental
A product is available for rental when its profile is a rental profile (Webshop → Product profiles → Rental). The price is then the price per day; the stock count is the number of units the store owns; and orders never reduce the stock. A period is counted in calendar days, including both dates, so Friday through Sunday is 3 days, and the line item’s price is the daily price × days × quantity. Montana, MontanaB2B, Delaware, and DelawareDK have the date picker built in. A custom theme does not get it automatically.
The product page
$product->getIsRental()returns 1 for rental products, and$product->getRentalMinDays()returns the shortest rental period (at least 1).- "Add to Cart" MUST send
rental_fromandrental_to(Y-m-d) along withproduct_id,amount, and the variant'sattributes[...]. Without them, the cart rejects the product, and the store owner receives a message that the theme is missing the date picker. - Display "per day" next to the price outside the cart, and hide shortcuts that cannot be used to select a time period: "Add to Cart" on the product card (link to the product page instead), a sticky purchase bar, Vipps MobilePay “Buy Now” button on the product page, and the subscription form.
The easiest way is to copy the three files from one of the built-in themes: components/rental-picker.html, dist/scripts/rental.js, and rental.css (Montana: dist/rental.css, Delaware: dist/styles/rental.css), and include the component within the “Add to Cart” form. The script works with both regular forms and forms submitted via JavaScript: it prevents the form from submitting until a valid time period has been selected.
<form action="" method="post">
<input type="hidden" name="product_id" value="<{$product->getProductId()}>"/>
<{if $product->getIsRental()}>
<{include file="components/rental-picker.html" product=$product}>
<{/if}>
<input type="number" name="amount" value="1" min="1"/>
<button type="submit">Læg i kurv</button>
</form>
If you're building the date picker yourself, two fields in the form should be enough:
<input type="date" name="rental_from" min="<{$smarty.now|date_format:'%Y-%m-%d'}>" required/>
<input type="date" name="rental_to" min="<{$smarty.now|date_format:'%Y-%m-%d'}>" required/>
Available dates: /rental-availability
JSON, never from the cache. Product pages may be stored in the shared page cache, so always retrieve availability from the browser. GET parameters: product_id, optional attribute_value_id (the variant), from, and to (Y-m-d, maximum 93 days, default from today and 61 days forward).
GET /rental-availability?product_id=311839&attribute_value_id=33978&from=2026-12-01&to=2026-12-03
{
"product_id": 311839,
"attribute_value_id": 33978,
"variant_required": false,
"min_days": 1,
"max_days": 365,
"today": "2026-11-14",
"units": 2,
"day_price": 1200,
"currency": "DKK",
"days": {"2026-12-01": 2, "2026-12-02": 1, "2026-12-03": 0}
}
"days" is the number of available units per day, and "days before today" is 0. The customer's own shopping cart has been subtracted. If a product with variants does not have an "attribute_value_id," " variant_required" is true, and a day counts as available when at least one variant is available. The number of available units in a period is the total number of units minus the highest number rented on any single day during that period.
Rejections: $rental_error
If the cart rejects the period, the customer is redirected back to the product page (#rental_error), or a fetch request returns an HTTP 409 (reload the page). $rental_error is then set once with product_id, code (missing, invalid, past, order, min_days, max_days, unavailable, or subscription), min_days, and available. Compare product_id with the product on the page.
Shopping Cart, Order, and Emails
- Cart lines:
$basket[i].rentalis eithernullor an array containingfrom,to, anddays.$basket[i].product->getRealPrice($amount, $attributes)already takes the number of days into account. The same product across two periods counts as two lines. - Order lines (thank-you page, order, customer account, emails, and printed invoice):
$op->getRental()onSafeOrderProductreturnsnullorfrom,to, anddays. The unit price is the price for the entire period.
<{if $rental = $op->getRental()}>
Lejeperiode: <{$rental.from|date_format:"%d.%m.%Y"}> – <{$rental.to|date_format:"%d.%m.%Y"}> (<{$rental.days}> dage)
<{/if}>
Declare that the theme supports rentals
Set "supports_rental": true in theme_settings.json if the theme includes the date picker. Without this setting, the admin will warn the shop owner on rental profiles that the theme cannot be used to rent out products.
Gift cards with a custom amount
A gift card product can have a custom amount: the store owner turns on "The customer chooses the amount in the online store" on the Credit, etc. card and sets a lowest and a highest amount. The customer enters the amount on the product page and pays it, and the gift card gets the same amount.
The product page
$product->getGiftCardAmountRange()returns['min' => …, 'max' => …]in the currency the customer shops in, or null for fixed-amount gift cards and all other products.- Add to cart MUST send the customer's amount in
giftcard_amount(e.g.350or350,50) together withproduct_idandamount. Without an amount, the basket rejects the product, and the store owner gets a notice that the theme lacks the amount field. - The basket line price is the customer's amount. Quantity gives several gift cards with the same amount, and two different amounts become two lines.
- The product's own price is shown in lists and product feeds. The store owner usually sets it to the lowest amount, so show "From" before the price.
- Product cards cannot add the product to the cart because the amount is missing. Link to the product page (e.g. "Choose amount"), and show neither Vipps MobilePay Express nor a sticky buy bar for the product.
<{if $gc_range = $product->getGiftCardAmountRange()}>
<label for="giftcard_amount">Gavekortets beløb</label>
<input type="text" id="giftcard_amount" name="giftcard_amount" inputmode="decimal" required
placeholder="<{$gc_range.min}>"> <{$webshop->getCurrency()}>
<small>Vælg et beløb fra <{$gc_range.min}> til <{$gc_range.max}>.</small>
<{/if}>
Rejections: $giftcard_amount_error
When the basket rejects the amount, the customer is sent back to the product page (#giftcard_amount_error), and a fetch request gets HTTP 409 (reload the page). $giftcard_amount_error is then set once: product_id, code (missing, invalid, min or max), min and max. Compare product_id with the product on the page.
The headless API
The product has giftcard_amount with min and max, or null. POST /basket must then have giftcard_amount in the body. A missing or wrong amount gives HTTP 400 with reason giftcard_amount_missing, giftcard_amount_invalid, giftcard_amount_min or giftcard_amount_max.
Declare that the theme has the amount field
Set "supports_giftcard_amount": true in theme_settings.json when the theme has the amount field. Without it, admin warns the store owner on the gift card product that customers cannot add it to the cart.
Tickets and partial payments
A product is considered a ticket item when its profile is a ticket profile (Webshop → Product profiles → Tickets). Each item has its own dates with a set number of seats, which are shared by all ticket types (variants of the profile, e.g., Adult and Child). Stock is not used. Partial payment (deposit now, balance later via an automatic remainder order) is enabled on the profile and works for tickets, rentals, and items with a delivery date. Montana, MontanaB2B, Delaware, and DelawareDK have this feature built in. A custom theme does not automatically include it.
Product page: Select a date
$product->getIsTicket()returns 1 for ticket products.$product->getTicketDates()returns the dates that can be booked (ticket_date_id,date,label,info,remaining,sold_out,price), and$product->getTicketSettings()returns the venue, terms and conditions, and attendee information.- "Add to Cart" MUST send
ticket_date_idalong withproduct_id,amount, and the ticket type'sattributes[...]. If the item has only one date, it is selected automatically. - Hide shortcuts that cannot submit a date: "Add to Cart" on the product card (link to the product page), a sticky purchase bar, and Vipps MobilePay Express on the product page.
- Sold-out dates may have a waiting list: POST
ticket_waitlist_signup=1,product_id,ticket_date_id, andemailto/.$ticket_waitlist_doneis set afterward.
The easiest way is to copy the components from Montana: components/ticket-picker.html, ticket-line.html, ticket-holders.html, down-payment-summary.html, down-payment-note.html, and ticket-order-box.html, plus dist/scripts/ticket.js and dist/ticket.css.
<{if $product->getIsTicket()}>
<{include file="components/ticket-picker.html" product=$product}>
<{/if}>
If you're building the date picker yourself, all you need is a field in the form:
<select name="ticket_date_id" required>
<{foreach $product->getTicketDates() as $d}>
<option value="<{$d.ticket_date_id}>"<{if $d.sold_out}> disabled<{/if}>><{$d.date|escape}></option>
<{/foreach}>
</select>
Seats and price by date: /ticket-availability
JSON, never from the cache. Product pages may be stored in the shared page cache, so retrieve the seat information from the browser. GET parameters: product_id and, optionally, attribute_value_id (the ticket type, so the price is correct). The customer’s own cart is subtracted from remaining, and null means unlimited.
GET /ticket-availability?product_id=311882&attribute_value_id=34006
{
"product_id": 311882,
"currency": "DKK",
"dates": [
{
"id": 16,
"starts_at": "2027-03-05 06:15:00",
"ends_at": "2027-03-12 15:05:00",
"date": "fre. 05.03.2027 kl. 06:15 – fre. 12.03.2027 kl. 15:05",
"label": "Uge 09",
"info": "05-03-2027 CPH 06:15 BOG 15:40 | 12-03-2027 BOG 19:10 CPH 14:35",
"remaining": 21,
"sold_out": false,
"price": 8995,
"price_formatted": "8.995,00"
}
]
}
Cart, attendees, and checkout
- Cart lines:
$basket[i].ticketisnullor an array containingdate,label,info,holder_fields, andholders. - The address step: If the item asks for participants (
holder_fieldsisnameorname_birthday), the fieldsticket_holders[<row-id>][<n>][name]and[birthday]are sent with the address form. The product’s additional fields are stored in$basket[i].ticket.fields(key,label,type,autocomplete,required) and are sent asticket_holders[<line-id>][<n>][fields][<key>]; the responses are stored inholders[n].fields. If names or required fields are missing, the customer is redirected back with?ticket_holders_missing=1#ticket_holders. - Partial payment:
$down_payment(cart, address, shipping, and approval) includesapplies,total,pay_now,remainder_total,send_date,due_date,label,can_pay_full,blocked, andblocking_gateway_ids. The customer’s selection is sent asdown_payment_choice=depositorfullwith the form on the final step. - The product page for items with a delivery date:
$product->getDownPaymentInfo()returnslabel,type,amount,percent,send_date, andapplies.
Thank-You Page, Orders, and Emails
SafeOrder:hasTickets(),getTicketUrl()(the customer's ticket page with QR codes, PDF, and calendar),getTickets(),getDownPayment()(the plan withpayment_urlandpay_now_url),getIsDownPaymentRemainder()andgetRemainderLines()(lines in the remaining order that are not included ingetOrderProducts()).SafeOrderProduct:getTicket()(date and tickets) andgetDownPayment()(deposit,remaining balance, andtotalper item).- "Pay the balance now": POST
pay_rest=1to the plan'spay_now_url. - On
/orderand the thank-you page, which can be opened with the order number and email address,getTicketUrl(),pay_now_url, and the tickets' (getTickets())code,url, andqr_urlarenullunless the visitor purchased the order in the same browser or is logged in as the customer. In that case, state that the tickets have been sent by email (hasTickets()). Emails are not affected. - Emails:
mails/tickets.html,ticket_reminder.html,ticket_cancelled.html,ticket_waitlist.html, anddown_payment_remainder.html. If any of these are missing, a default message is sent, and the store owner receives a notification.
<{if $order->hasTickets()}>
<a href="<{$order->getTicketUrl()|escape}>">Se dine billetter</a>
<{/if}>
<{if $plan = $order->getDownPayment()}>
Restbeløb <{$plan.remainder_formatted|escape}>, senest <{$plan.due_date|date_format:"%d.%m.%Y"}>
<{/if}>
State that the theme can sell tickets
Set "supports_tickets": true and "supports_down_payment": true in theme_settings.json when the theme includes the date picker and payment plan. Without them, admin warns the shop owner on the profiles, and without supports_down_payment, customers pay the full amount immediately.
Post-purchase upsell
Post-purchase upsell shows suggested products on the thank-you page (thanks.html) after the customer has completed their purchase. The customer can add one or more products with a single click, and a new order is created with the same address, shipping, and payment method as the purchase just completed. The store owner manages the products and settings in admin under Products → Upselling after purchase.
The feature is already built into the Montana, Delaware, and DelawareDK themes. If you use your own theme, you can add it yourself. The backend does all the work (selecting products, creating the order, payment, stock, legal requirements); your theme only needs to show the products and send the customer's choice to the /upsell-order endpoint. Below are the contract and a complete example.
Variables on the thank-you page
When upsell is active and the order is confirmed, Shoporama assigns these variables to thanks.html (they are only set when there is something to show):
$upsell_products— array of SafeProduct. Already filtered server-side (excludes products just purchased and bundles, respects "Only simple products", and fills up with best sellers).$upsell_order_id— the webshop_order_id of the order just completed (sent as a hidden field).$upsell_chk— security token (md5 of the email) that verifies ownership of the order.$upsell_order_time— the order time (unix). Use it to anchor a countdown so it doesn't reset on reload.$upsell_free_shipping— 1 if the upsell order has free shipping, otherwise 0.$settings.checkout_upsell.*— the theme settings (see below).
Theme settings (theme_settings.json)
Add a checkout_upsell group to your theme's theme_settings.json so the store owner can control the heading, intro, and countdown. Only use supported field types (string, textarea, bool — NOT number):
{
"path": "checkout_upsell",
"name": "Checkout: Mersalg",
"fields": [
{ "path": "title", "name": "Overskrift", "type": "string" },
{ "path": "intro", "name": "Intro-tekst", "type": "textarea" },
{ "path": "enable_countdown", "name": "Vis nedtælling", "type": "bool" },
{ "path": "countdown_minutes","name": "Nedtælling (minutter)", "type": "string" },
{ "path": "countdown_text", "name": "Nedtællingstekst ({time})", "type": "string" }
]
}
Endpoint: POST /upsell-order
The entire section is one <form method="post" action="/upsell-order"> (no nested forms). The fields:
order_id+chk— hidden fields with $upsell_order_id and $upsell_chk (verifies ownership).terms— mandatory checkbox (acceptance of the terms and conditions). Enforced server-side.buy_single— one product_id (buying a single product). The button's name/value.product_ids[]— multiple product_ids (buying several via checkboxes + a "Buy selected" button with name="buy_selected").attributes[product_id][attribute_id]— selected attribute value ID for variant products (from a select per variant attribute).
The backend creates the order and redirects to payment on its own. You do NOT need to handle address, shipping, price, or payment yourself.
Example: minimal partial
A complete, working starting point. Include it in thanks.html with <{include file="partials/checkout.upsell.html"}>. Simple products get a "Buy and pay" button; variant products get a variant picker (bundles are already filtered out server-side). The button text must signal an obligation to pay (legal requirement).
<{* Vises kun når butiksejeren har aktiveret mersalg i admin — backend sætter $upsell_products derefter *}>
<{if $upsell_products && $upsell_order_id}>
<section data-upsell-order-time="<{$upsell_order_time}>"
<{if $settings.checkout_upsell.enable_countdown && $settings.checkout_upsell.countdown_minutes}>data-upsell-countdown="<{$settings.checkout_upsell.countdown_minutes}>"<{/if}>>
<h2><{if $settings.checkout_upsell.title}><{$settings.checkout_upsell.title|escape}><{else}><{t}>Glemte du noget?<{/t}><{/if}></h2>
<{if $settings.checkout_upsell.intro || $upsell_free_shipping}>
<p><{if $settings.checkout_upsell.intro}><{$settings.checkout_upsell.intro|escape}> <{/if}><{if $upsell_free_shipping}><{t}>Fri fragt på det, du tilføjer her.<{/t}><{/if}></p>
<{/if}>
<form method="post" action="/upsell-order" data-upsell-form>
<input type="hidden" name="order_id" value="<{$upsell_order_id}>">
<input type="hidden" name="chk" value="<{$upsell_chk}>">
<{foreach from=$upsell_products item=p}>
<div data-upsell-item>
<{include file="components/product-card.html" product=$p show_add_to_cart="false"}>
<{if $p->hasVariants()}>
<{$prof = $p->getProfile()}>
<{if $prof}><{foreach from=$prof->getAttributeList() item=attr}>
<{if $attr->getIsVariant() && $attr->getDataType() == "valuelist"}>
<select name="attributes[<{$p->getProductId()}>][<{$attr->getAttributeId()}>]" data-upsell-variant>
<option value=""><{t}>Vælg<{/t}> <{$attr->getName()|escape}></option>
<{foreach from=$attr->getValues() item=val}>
<option value="<{$val->getAttributeValueId()}>"><{$val->getVal()|escape}></option>
<{/foreach}>
</select>
<{/if}>
<{/foreach}><{/if}>
<{/if}>
<button type="submit" name="buy_single" value="<{$p->getProductId()}>" data-upsell-buy><{t}>Køb og betal<{/t}></button>
<label><input type="checkbox" name="product_ids[]" value="<{$p->getProductId()}>" data-upsell-checkbox> <{t}>Vælg til samlet køb<{/t}></label>
<label><input type="checkbox" name="terms" value="1" required> <{t}>Accepter handelsbetingelser<{/t}></label>
</div>
<{/foreach}>
<button type="submit" name="buy_selected" value="1" data-upsell-multi><{t}>Køb og betal valgte<{/t}></button>
</form>
</section>
<{/if}>
Important notes
- Variants and bundles: A product can only be ordered with one click if it is simple. Check
$p->hasVariants()and show a variant picker (a select per variant attribute) for variant products. Bundles are already removed from$upsell_productsserver-side, so you don't need to handle them. - Terms and conditions: The terms field is mandatory (card acquirer requirement). The button text must signal an obligation to pay, e.g. "Buy and pay", not just "Add".
- Countdown: Anchor it to
$upsell_order_time(order time + minutes), not to "now", so it doesn't reset on reload. It is purely visual; the backend decides whether the order can actually be created. - Product card: Include
components/product-card.htmlwithshow_add_to_cart="false"so the card's own "add to cart" doesn't render a form inside the upsell form. - JS (optional, recommended): Enable the "Buy" button only once a variant is selected and the terms are accepted, and disable the buttons on submit to prevent double clicks. See the Montana/Delaware themes for a ready-made example.
B2B
A theme can run in B2B mode: prices are shown excl. VAT (with an optional VAT toggle), the store can require login, and customers can be offered quick reordering and company administration. Shoporama core knows nothing about B2B — the theme enables and controls all of it itself, so you're free to build your own B2B theme without hardcoded theme name detection. The built-in MontanaB2B is the reference implementation.
The pricing logic itself (customer groups, fixed group prices, volume discounts, brand access, VIES-validated reverse charge) is controlled by the store owner in admin and by the backend. Your theme just calls getRealPrice() as usual — it automatically returns the right price for the logged-in customer. The rest of this section covers the theme primitives that make a theme B2B-ready.
Enable B2B mode ($b2b)
Set $b2b to true at the top of index.html (the theme's entry template). The variable is available in all templates and controls the excl. VAT display and the B2B UI. A B2C theme doesn't set it — then it's falsy, and everything behaves as normal.
<{* index.html — dette tema er kodet som B2B *}>
<{$b2b = true}>
Login wall (soft gate)
To require login to view the store, render the login template instead of the content when the customer isn't logged in — except on the auth pages (login/sign-up/reset/token), so people can get in. Do this in index.html. Login is handled at /user-sign-in, so have the login form post there (not to the current page); Shoporama sends the customer back afterwards via the referer.
<{$auth_page = ($inc == 'user-sign-in.html' || $inc == 'user-sign-up.html' || $inc == 'user-reset-password.html' || $inc == 'user-token.html')}>
<{if !$customer && !$auth_page}>
<{include file="user-sign-in.html"}>
<{elseif $inc}>
<{include file=$inc}>
<{elseif $product}>
<{include file="product.html" product=$product}>
<{* ... øvrige content-grene (kategori, forside, side ...) *}>
<{/if}>
Assets, ajax, and payment callbacks never reach index.html (Shoporama handles them earlier), so the login wall doesn't affect them. A guest only sees the login template — the content templates and their headers are never rendered for a guest.
Custom storefront routes (storefront_routes)
If your theme offers extra pages such as quick order or company administration, declare their routes in theme_settings.json with storefront_routes. Shoporama makes exactly those routes valid for your theme. This covers template routes (e.g. user-order → user-order.html), pure JSON endpoints without a template (e.g. user-order-search), and redirect routes (e.g. user-company-login-as).
{
"info": "Mit B2B-tema",
"storefront_routes": [
"user-order",
"user-order-search",
"user-company",
"user-company-login-as",
"user-company-switch-back"
]
}
Only declare the routes your theme actually uses. Routes a theme doesn't declare aren't valid (404) — so two themes can't collide on the same route name.
Prices excl. VAT + VAT toggle
getRealPrice() ALWAYS returns the price incl. VAT (the order math is unchanged) — the excl. VAT display is purely cosmetic. Calculate a VAT factor and divide the display price by it:
<{$b2b_factor = 1}>
<{if $b2b}><{$b2b_factor = 1 + ($product->getProductVat() / 100)}><{/if}>
<{$price = $product->getRealPrice() / $b2b_factor}> <{* pris ekskl. moms til visning *}>
An optional VAT toggle lets the customer switch between excl. and incl. without reloading. Enable it with a bool theme setting ($settings.product.enable_vat_toggle) and output both values on every amount in a .vat-num element (format the numbers with number_format as usual). The built-in JS in MontanaB2B's partials/assets.html switches the display on all .vat-num elements, toggles .vat-suffix-excl/.vat-suffix-incl, and remembers the choice in localStorage (vatMode, default excl.):
<{$vt_on = ($b2b && $settings.product.enable_vat_toggle)}>
<span class="vat-num"<{if $vt_on}> data-excl="<{$price}>" data-incl="<{$price*$b2b_factor}>"<{/if}>><{$price}></span>
<{* Suffiks der følger skifteren *}>
<span class="vat-suffix-excl"><{t}>ekskl. moms<{/t}></span>
<span class="vat-suffix-incl" style="display:none"><{t}>inkl. moms<{/t}></span>
<{* Skifte-knapper et centralt sted, fx i headeren *}>
<div data-vat-toggle>
<button data-vat-mode="excl"><{t}>Ekskl. moms<{/t}></button>
<button data-vat-mode="incl"><{t}>Inkl. moms<{/t}></button>
</div>
ALWAYS derive both excl. and incl. from getRealPrice() via the VAT factor (as above), so they're consistent — group prices included. Do NOT use getRealPriceExVat() for display; it doesn't know about group prices and would show an incorrect excl. price for group customers.
Group prices
Customer-specific prices (fixed group prices, volume discounts, brand discounts) are applied automatically by getRealPrice() for the logged-in customer — your theme doesn't need to do anything special. The prices respect the customer group's brand access: a product from a brand the group isn't allowed to buy gets the regular price and can't be added to the cart. Just display getRealPrice() as usual.
Reorder CSV in the order email
If your theme has a quick order page (user-order in storefront_routes), Shoporama automatically attaches a reorder CSV (SKU;quantity) to the order confirmation email for registered customers. Show a note about it in your mails/order_sent.html — only when a CSV is actually attached — using the $has_reorder_csv variable. To turn off the attachment, set this in theme_settings.json:
{
"order_mail_reorder_csv": false
}
Product filtering
Shoporama can provide faceted filtering on category pages, search pages, brand pages, and dedicated filter pages. The shop owner builds the filter themselves in the admin panel under Design → Filter, and the theme renders it as a standard GET form. Filtering takes place on the server side, so it works without JavaScript, and the customer’s selections are reflected in the URL.
Enable it in your theme
Set supports_filters in theme_settings.json. Without it, the Design → Filter menu item is not shown at all, and the shop owner cannot create a filter. The flag is your promise that the theme actually renders $facets wherever it shows products:
{
"info": "Mit tema",
"supports_filters": true
}
The flag says nothing about WHICH facet types the theme can display, and it does not need to. All facets have the same shape — name, options, count — so a new facet type in Shoporama works in your theme without you changing anything.
Variables
If there is a filter for the page being rendered, Shoporama assigns these variables. If there is no filter, $facets is empty, and your template should behave as before.
| Variable | Content |
|---|---|
$facets | The facets in the shop owner's order. Each has slug, name, param, multi, and options, where each option has value, name, count, and selected. |
$filter_active | True when the customer has selected something. Use it to hide content that is NOT filtered, e.g. popular products or the subcategory grid, so it does not look like results. |
$active_filters | The selected filters, each with group, name, and a ready-made url that removes exactly that selection. |
$filter_base_url | The form's action. |
$filter_clear_url | Clears all facets but keeps the sorting and search terms. |
$filter_hidden_args | Parameters that must survive a submit (sorting, search terms). Output them as hidden fields in the form. |
Render the facets
The control type is determined by the facet's SHAPE, not its type. If multiple selections are allowed, use checkboxes in an array. If there is only one option, a single checkbox is right, so the customer can turn it off again. Multiple options without multi-select are a radio group:
<{if $facets}>
<form method="get" action="<{$filter_base_url|escape}>">
<{foreach $filter_hidden_args as $arg_name => $arg_value}>
<{if $arg_value !== "" && $arg_value !== null}>
<input type="hidden" name="<{$arg_name|escape}>" value="<{$arg_value|escape}>">
<{/if}>
<{/foreach}>
<{foreach $facets as $facet}>
<fieldset>
<legend><{$facet.name|escape}></legend>
<{$option_count = $facet.options|@count}>
<{foreach $facet.options as $option}>
<label>
<{if $facet.multi}>
<input type="checkbox" name="<{$facet.param|escape}>[]" value="<{$option.value|escape}>"<{if $option.selected}> checked<{/if}>>
<{elseif $option_count == 1}>
<input type="checkbox" name="<{$facet.param|escape}>" value="<{$option.value|escape}>"<{if $option.selected}> checked<{/if}>>
<{else}>
<input type="radio" name="<{$facet.param|escape}>" value="<{$option.value|escape}>"<{if $option.selected}> checked<{/if}>>
<{/if}>
<span><{$option.name|escape}></span>
<span><{$option.count}></span>
</label>
<{/foreach}>
</fieldset>
<{/foreach}>
<button type="submit"><{t}>Vis resultater<{/t}></button>
</form>
<{/if}>
The selected filters are typically shown as clickable labels above the results. Each of them is just a link:
<{foreach $active_filters as $chip}>
<a href="<{$chip.url|escape}>"><{$chip.group|escape}>: <{$chip.name|escape}> ×</a>
<{/foreach}>
<{if $active_filters}><a href="<{$filter_clear_url|escape}>"><{t}>Ryd alle<{/t}></a><{/if}>
Shared values. If the values in an attribute group are linked to shared values (e.g., Small, Medium, Large), they are grouped under the shared value’s name, so that “Medium” appears only once and displays products from all profiles. Shared values from attributes in other profiles that share values with the group’s attributes are automatically included in the group (only the shared values, not their regular ones). The theme doesn’t need to do anything: these are still just options on the facet. See also ` shared_values ` under Ajax.
Intervals. If the store owner has enabled "Show as intervals" for an attribute group, the options will be numerical intervals (e.g., "Less than 250 bar," "400 bar and up") instead of individual values. ` value ` is the interval’s slug, and the rest is the same as before, so the theme doesn’t need to do anything.
The filter page
If the shop owner gives the filter an address, it gets its own page at /filter/<slug>, and Shoporama includes filter.html from your theme. It works like a category page without a category: it gets $products, $pager, $count, and the same filter variables, plus $filter_name. If your theme has no filter.html, do not give filters an address.
Remember the pager. If you build pager URLs yourself, they must carry the filter parameters, or the customer loses the filter on page 2. Shoporama adds them to the pager that is assigned, so use it instead of building your own links.
Ajax
Shoporama has two built-in AJAX calls. One can retrieve products in various ways (filtering), and the other is a general, simple search that searches products, categories, and landing pages.
Filtering
Filtering is handled by the file /ajax, which is located in the root of every shop
atags
A list of tags on the attribute values. Attribute values are settings on the attributes of the products' profiles. The values in atags must be separated by commas, but you can group values separated by a pipe as a logical OR.
ajax?atags=female,black|white
product_ids
List of product_ids separated by pipes.
ajax?product_ids=1|2|3|4
price_range
Returns products within a price range. The amounts must be separated by a pipe.
ajax?price_range=100|200
categories
A pipe-separated list of categories the products must be in. If the argument exclude=1 is set, a list of products that do not have the categories is returned.
ajax?categories=5|9|2
ajax?categories=5|9|2&exclude=1
sort
Sort order. Possible values are popular, weight, name, price, created, and manual. To specify whether the sort order should be ascending or descending, set sort_order to either asc (ascending) or desc (descending).
"price " sorts by the price the customer sees: the sale price when the item is on sale, or the regular price otherwise. The same applies to "sort=price" on category, brand, and filter pages.
"manual" is used in conjunction with "landing_pages" and displays the products in the landing page's own order: first those that the shop owner has placed manually, then the rest in the landing page's sort order. "sort_order " is ignored. If multiple landing pages are specified, they appear in the order listed. Without a sort order, the order is automatically applied when there is a single landing page and it has a manual order.
ajax?sort=price&sort_order=desc
ajax?landing_pages=24&sort=manual
attribute_values
A list of IDs of the attribute values the products must have. The list is separated by pipes. If the argument exclude=1 is set, a list of products that do not match is returned.
ajax?attribute_values=9|8|12
suppliers
Pipe-separated list of supplier IDs.
ajax?suppliers=8|2
landing_pages
A pipe-separated list of IDs for the landing pages on which the products should appear. Use sort=manual to display the products in the landing page's own sort order, including a manual sort order.
ajax?landing_pages=5|24
extension.{id}
If the theme uses extension fields, products can be retrieved based on them. The searches are exact matches, so the most useful fields are bool, multi, number, and list. You can use pipe-separated values if the products only need to match one of the values.
ajax?extension.foo=1&extension.tags=foo|bar
attribute_tags_in_stock
List of tags on attribute values that must be in stock. The list can be pipe-separated.
ajax?attribute_tags_in_stock=foo|bar
attribute_tags
List of tags that must be set on the products. The list can be pipe-separated.
ajax?attribute_tags=foo|bar
shared_values
IDs for shared values (e.g., Small, Medium, Large) that the store owner creates under Product Profiles → Shared Values. Returns products with that shared value regardless of which profile they use, so “Medium” finds both T-shirts and pants. | means “or,” and , means “and.” The example returns products that have shared value 2 or 3, and also shared value 5. It matches both variant values and regular attribute values in the product’s current profile. Invalid IDs return no products. The IDs can be found via $webshop->getSharedValues() or meta.shared_values.
ajax?shared_values=2|3,5
shared_values_in_stock
Same as shared_values and with the same syntax, but only includes variants that are in stock with that value. For regular attribute values, the product must be in stock (or allow negative stock levels). If both are set, only shared_values_in_stock is used.
ajax?shared_values_in_stock=2|3,5
attribute_tag
Same as attribute_tags, but with just a single tag.
ajax?attribute_tag=foo
force_categories
A pipe-separated list of category IDs that must all be set on the products.
ajax?force_categories=5|9|2
limit
Maximum number of products to return. The highest allowed value is 1000, and higher values are capped automatically (so the entire catalog is never built in memory in a single call). Fetch several times with offset instead.
ajax?limit=10
offset
Start position in the product list to fetch from.
ajax?offset=100&limit=10
meta
Pipe-separated list of extra fields you want to see on the products in the result. If you set meta=_all, all of them are returned.
ajax?meta=foo|bar
ajax?meta=_all
only_in_stock_variants
Set to 1 or 0 depending on whether each product in the result should only include variants that are in stock. Default is 0.
ajax?only_in_stock_variants=1
include_meta
Set to 1 or 0 depending on whether you want an extra meta field in the result that describes the products in the result. It contains information about which attributes, categories, and brands exist. Default is 0.
Each value in meta.attributes has the attribute_shared_value_id field (the ID of the shared value, or null). In addition, there is meta.shared_values: a list of the shared values used by the products in the result, sorted by the store owner’s sort order, each with attribute_shared_value_id, value, num_value, weight, and attribute_value_ids (the profile values it covers). num_value is a number taken from the start of the value, e.g. 400 for "400 bar", otherwise null.
ajax?include_meta=1
include_pagination
Set to 1 or 0 depending on whether you want an extra pagination field in the result with paging information. The fields in the array are offset, limit, count, total. The default is 0.
ajax?include_pagination=1
include_similar
Set to 1 or 0 depending on whether each product should include its similar products—for example, the other colors when each color is its own product. The default is 0, and omitting this parameter leaves the result unchanged.
Each product has two fields: similar_products, which contains product_id, name, url, thumbnail, in_stock, and attributes for each similar product; and attributes, which contains the product’s own attributes, so that the card’s own color is also known. Only similar products that are online are included—up to 25 per product and in the order they appear on the product page in the admin panel. The product itself is not included.
An attribute has attribute_id, attribute_name, attribute_tag, purpose (the purpose from the profile, e.g., color), attribute_value_id, value, and value_tag. Variants and customer input are not included. For example, add the hex code as a tag to each color value, and it will appear in value_tag.
ajax?categories=12&include_similar=1
"attributes": [
{"attribute_id": 120, "attribute_name": "Farve",
"attribute_tag": "farve", "purpose": "color",
"attribute_value_id": 801, "value": "Hvid",
"value_tag": "#ffffff"}
],
"similar_products": [
{
"product_id": 1043,
"name": "Original T-shirt | Sort",
"url": "https://example.com/original-t-shirt-sort",
"thumbnail": "https://example.com/cache/.../fit-200x200x90.png",
"in_stock": true,
"attributes": [
{"attribute_id": 120, "attribute_name": "Farve",
"attribute_tag": "farve", "purpose": "color",
"attribute_value_id": 802, "value": "Sort",
"value_tag": "#000000"}
]
}
]
With attributes, you’ll only get the attributes that the theme uses, both for the product and for each similar product. This makes the response much smaller when the profile has many attributes. Specify IDs or tags separated by commas or |. A tag matches the attribute in all profiles; an ID matches it in only one. Without this parameter, all are included. It only works in conjunction with include_similar.
ajax?categories=12&include_similar=1&attributes=farve,color_hex
pretty
Set to 1 or 0 depending on whether the JSON response should be pretty-printed.
ajax?pretty=1
The response from /ajax is an array in the format below:
[
{
"product_id": 139735,
"own_id": "skunumme",
"name": "Produktnavn",
"supplier_id": 0,
"supplier_name": "",
"category_ids": [
3661,
2113,
2106,
1973
],
"category_names": [
"Bob",
"Forside",
"Ged",
"Giraf"
],
"description": "<p>...</p>",
"list_description": "",
"profile_name": "Default m. variant",
"allow_negative_stock": 1,
"brand_name": "TESTBRAND",
"sale_price": 0,
"real_price": 80,
"price": 80,
"price_dk": "80,00",
"approx_shipping": 0,
"delivery_time": "",
"delivery_time_not_in_stock": "",
"url": "https://example.com/produkt",
"stock": 0,
"attr_stock": null,
"variant_stock": [
{
"attribute_id": 2740,
"attribute_value_id": 16287,
"name": "S",
"weight": 10,
"cnt": 4
},
{
"attribute_id": 2740,
"attribute_value_id": 16289,
"name": "L",
"weight": 30,
"cnt": 9
}
],
"stock_string_da": "Nej",
"avg_rating": null,
"thumbnail": "https://example.com/cache/1/9/6/9/bob-fit-200x200x90.png",
"meta_values": [
null
],
"online_since": 1651685711,
"has_campaigns": true,
"campaign_info": [
{
"name": "Bob",
"price_model": "cheapest_free",
"min_product_count": 4,
"price": 0,
"percent": 0,
"created": "2023-02-01 14:55:47",
"expires": null
}
]
}
]
For performance reasons, we cache the response from the Ajax file, but in a test environment, you can add rebuild=1 as
an argument to force the page to be rebuilt. We recommend that you do not do this in a production environment, as it can significantly slow down the page.
Search
The /ajax_search page contains a general search function for products, categories, and landing pages. It can be used, for example,
for autocomplete in a search field. It takes the following arguments:
term
The search term.
ajax_search?term=ostemad
limit
Max. number of results.
ajax_search?term=ostemad&limit=25
include
A comma-separated list of data types you want to search. The values can be products, categories, blog_posts, pages, and landing_pages.
ajax_search?term=ostemad&include=products,categories
Each result has a type field you can group by or assign icons by. The values are product, category, landing_page, blog_post, and page. Note that until August 2026, static pages were incorrectly returned as blog_post — if your theme matches on that value to show pages, change it to page.
pretty
Set to 1 or 0 depending on whether the JSON response should be pretty-printed.
ajax_search?term=ostemad&pretty=1
sort
Sort the product results by one of the theme's extension fields (defined in extensions/product.json). Prefix with - for descending order. The value of the sorted field is included in each product object, so it can be shown in, e.g., an autocomplete dropdown. Fields not defined by the theme are ignored — so unknown field names cannot be used to probe data.
ajax_search?term=harry&sort=-release_date
The result is an array in the format below:
[
{
"name": "Produkt et",
"supplier": "",
"description": "<p>...</p>",
"price": 80,
"sale_price": null,
"normal_price": 80,
"currency": "DKK",
"price_dk": "80,00",
"url": "https://example.com/produkt-et",
"stock": 0,
"stock_string_da": "Nej",
"review_avg": 0,
"thumbnail": "https://example.com/cache/1/9/8/4/box-100x100x90.png",
"type": "product",
"variants": [],
"categories": [
{
"category_id": 12,
"parent_id": null,
"name": "Frokost",
"url": "https://example.com/frokost"
}
]
},
{
"name": "Produkt to",
"supplier": "",
"description": "<p>...</p>",
"price": 80,
"sale_price": null,
"normal_price": 80,
"currency": "DKK",
"price_dk": "80,00",
"url": "https://example.com/produkt-to",
"stock": 0,
"stock_string_da": "Nej",
"review_avg": 0,
"thumbnail": "https://example.com/cache/1/9/6/9/bob-box-100x100x90.png",
"type": "product",
"variants": [],
"categories": [
{
"category_id": 12,
"parent_id": null,
"name": "Frokost",
"url": "https://example.com/frokost"
},
{
"category_id": 17,
"parent_id": 12,
"name": "Smørrebrød",
"url": "https://example.com/smoerrebroed"
}
]
}
]
Tracking
There are two generations of tracking in Shoporama, and as a theme developer it's important to know the difference.
Built-in tracking (the theme doesn't need to do anything)
Shoporama's built-in tracking module (Webshop → Tracking in the admin panel) is injected server-side, bypassing the theme. As a theme developer, you do not need to add partials, scripts, or dataLayer code to support it. The module automatically sends e-commerce events (view_item, view_item_list, search, add_to_cart, view_cart, the begin_checkout steps, add_shipping_info, add_payment_info, and purchase) to the ad platforms the store has enabled, and the product ID in all events automatically matches the store’s Google Shopping feed, so catalog matching on Meta and Google works without any involvement from the theme.
Custom dataLayer in the theme (older pattern)
Shops with their own Google Tag Manager setup can push events from the theme via a datalayer partial (typically partials/datalayer.html), gated on the shop's old tracking flag ($webshop->getEnableTracking()). If you use that pattern, there are two pitfalls:
1. Never build product IDs by hand. Use getTrackingId() on the product so the ID always matches the shop's feed (numeric product ID, variants as productid:variantid, or SKU for shops with country/language feeds):
<{* Produkt uden variant *}>
'item_id': '<{$product->getTrackingId()}>'
<{* Produkt med valgt variant *}>
'item_id': '<{$product->getTrackingId(null, $attribute_value_id)}>'
Older datalayer partials build variant IDs in reverse order (variantvalue:productid) on product views. That matches neither the feed nor the purchase events, and it breaks catalog matching. Switch to getTrackingId() instead of building the ID yourself.
2. Protect conversion code against double firing. The receipt page can be reloaded, so conversion snippets on the thanks page must be gated on the order's tracking flag:
<{if $order && !$order->getTrackingCalled()}>
<!-- konverterings-scripts/pixels her -->
<{$order->setTrackingCalled()}>
<{/if}>
See the full guide with GTM setup, triggers, and custom events in Implementing tracking in a Shoporama theme.