PayNow

Editing Template Files

Webstore templates are Twig, and this is the reference for routes, template files, variables and modules.

Hosted webstore templates use Twig. Each customer-facing route renders a specific template file, and each file receives a set of variables.

Dashboard → Appearance → Webstore → Templates → (a template) → files.

The developer docs at docs.paynow.gg/hosted-webstores are the canonical reference, and are updated first.

Duplicate before you edit. There is no version history and no rollback. Your only backup is Export Template. Edit a duplicate, preview it, then set it active. See Templates.

Routes and their template files

RouteMethodTemplate fileRenders
/GETindex.htmlThe storefront homepage
/productsGETcategory.htmlProduct listing, optionally filtered by tag
/products/{product.slug}GETproduct.htmlA single product's detail page
/cartGETcart.htmlThe shopping cart
/subscriptionsGETsubscriptions.htmlThe customer's subscriptions
/completeGETcomplete.htmlConfirmation after a successful transaction
/legal/terms-of-serviceGETNoneTerms of Service
/legal/user-agreementGETNoneUser Agreement
/legal/privacyGETNonePrivacy Policy

Action endpoints

These accept POSTs and do not render a template. Point forms and buttons at them.

EndpointMethodDoes
/products/{product.slug}/checkoutPOSTStarts checkout for one product
/cart/add/{product.slug}POSTAdds to cart
/cart/set/{product.slug}POSTModifies or removes a cart line item
/cart/emptyPOSTClears the cart
/cart/checkoutPOSTChecks out the cart
/auth/sign-inPOSTSigns the customer in, with optional redirect
/auth/sign-outPOSTSigns the customer out
/subscriptions/{subscription.id}/cancelPOSTCancels a subscription

Wire the cancel endpoint into your subscriptions page, or link customers to checkout.paynow.gg/subscriptions, rather than building your own cancellation flow. A customer who cannot find how to cancel disputes the charge instead. See Subscriptions.

Variables

Global, available in every template

VariableWhat it holds
storeYour store's details
webstoreWebstore configuration
cartThe current customer's cart
navlinksYour configured navlinks
tagsYour tags
customerThe signed-in customer, if any
requestThe current request
notificationAny notification to surface to the customer
currencyThe active display currency
available_currenciesCurrencies the customer can switch to
modulesConfigured modules, rendered
faviconThe store favicon

Always check customer before using it. It is empty for signed-out visitors, and a template that assumes a signed-in customer breaks the storefront for everyone browsing anonymously, which is most of your traffic.

Page-specific

TemplateVariableWhat it holds
index.htmlproductsAll available products
category.htmlproductsProducts matching the active tag
activeTagThe tag currently filtering
activeTagsAll active filtering tags
activeNavlinkThe active navigation link object
product.htmlproductThe selected product
available_gameserversOptional gameserver choices for the customer
complete.htmlcompleteInformation about the completed order
subscriptions.htmlsubscriptionsThe customer's subscriptions

available_gameservers is how a customer chooses which server their purchase applies to. Leave it out of product.html in a multi-server store and purchases land on the wrong server, which generates refund requests. See Game Servers.

Modules

Modules are rendered wherever you output the modules variable:

This auto-populates every module you have configured. The raw filter is required; without it the HTML is escaped and customers see markup instead of content.

Each module type has its own file, so you can override the markup individually:

ModuleFile
Featured Productmodule.featured_product.html
Payment Goalmodule.payment_goal.html
Recent Paymentsmodule.recent_payments.html
Top Customermodule.top_customers.html
Gift Card Balancemodule.giftcard_balance.html
Text Boxmodule.text_box.html

The Top Customer file is plural while the module name is singular. That's not a typo here.

Configuration lives in the dashboard, not the template: Payment Goal's Goal Target and Period, Top Customer's Field and limit. See Webstore → Modules.

Before activating any template change

Click through all of these in Live Template Preview:

  • Homepage
  • A category page, with a tag filter applied
  • A product page, signed out
  • A product page, signed in
  • Cart, with and without items
  • The subscriptions page
  • The completion page

Signed-out states are the ones that break, because they are the ones you never look at while developing.