Guide 08 · Developer docs

Commerce

A Core dna store is a set of records and an API that moves a purchase from cart to order: products described in every language and priced in every currency the store sells in, a cart, a checkout that becomes an order, invoices, payments, tax and shipping. The site builds the storefront on top: the cart and checkout pages, their scripts, and the customer emails.

L2–L3
Unit 08 · Reference

Commerce settings reference

The commerce modules' settings, one entry each: its admin label, type and default, what it does, and whether it should differ between environments.

Who this is for. Developers and site administrators configuring a store. Look a setting up here: its label in the admin, its type and default, what it does, and whether staging and production should differ. How the settings are used in a build is on the guide's other pages.

True of every setting below, and not repeated in each entry:

  • Where it is set: the module's settings page in the admin, under the label each entry gives. An entry whose label reads "Not shown in the admin" is set in .settings.json, described next.
  • Scope: a stored setting belongs to the client account, so one value applies to every site of the account. A site that needs a different value sets it in a .settings.json file at the root of its repository, which takes precedence over the admin. For example, {"Checkouts": {"guestCheckout": {"value": false}}}.
  • Environments: a value saved in the admin is stored in that environment's database. A value set on staging is not on production until someone sets it there too. A value in .settings.json travels with the repository instead. The Per environment row says when the values should differ.
  • Key: the name used to read the setting, Module.key.

Reading a setting in a template

$_config reads any setting except those of the Environment, Mailer and Documentation modules, which return ***. Test a switch by its truth, as here:

Template code
{if $_config->get('Checkouts.guestCheckout')}
  <p>You can check out as a guest.</p>
{/if}
{% if _config.get('Checkouts.guestCheckout') %}
  <p>You can check out as a guest.</p>
{% endif %}

Carts

Carts.lifetime

Admin labelLifetime
TypeNumber, in seconds
Default15552000 (180 days)
EffectHow long a guest cart is kept after its last change before the platform's clean-up job deletes it. It is also the lifetime of the cart cookie, set again on every visit that loads the cart and by the restore link. A cart whose person has a login is kept.
Per environmentNo

Carts.abandonedThreshold

Admin labelAbandoned Threshold
TypeNumber, in seconds
Default3600 (one hour)
EffectHow long a cart must go unchanged before it counts as abandoned. A cart qualifies with items, a person with an email address, and no checkout in progress. A job that runs every five minutes fires the Abandoned event once for each qualifying cart; a later change makes the cart eligible again. See abandoned carts.
Per environmentLower it on a test site to see an abandoned-cart job run without waiting an hour

Carts.abandonedBatchSize

Admin labelNot shown in the admin
TypeNumber
Default200
EffectThe most carts the abandoned-cart job examines in one run. A backlog is worked through over several runs.
Per environmentNo

Checkouts

Checkouts.guestCheckout

Admin labelEnable guest checkout
TypeSwitch
DefaultOn
EffectOn, a shopper can check out without signing in, and the guest's email address creates a person with no login; see guest and account checkout. Off, checkout is for signed-in members: the checkout API answers 401 to anyone else, so send signed-out shoppers to sign in before they reach /checkout.
Per environmentNo

Checkouts.recaptcha

Admin labelRequire captcha
TypeSelect: disabled (Disabled), checkbox (Enabled - Checkbox), invisible (Enabled - Invisible)
Defaultcheckbox
EffectThe reCAPTCHA v2 mode at payment. The purchase call checks the token, sent as _recaptchaToken, before anything else. The cart page and the checkout page receive _recaptcha to render the widget. disabled skips the check and leaves _recaptcha unset.
Per environmentNo. The reCAPTCHA keys are environment configuration, set by Core dna

Checkouts.lifetime

Admin labelCheckout Lifetime
TypeNumber, in seconds
Default1800 (30 minutes)
EffectHow long a checkout still attached to its cart is kept without activity. After that a background job deletes it, its cookie expires with it, and the shopper starts a new checkout from the cart. Once a payment has been sent whose result comes later (an authentication challenge, a redirect to the provider, a pending payment or a partial payment), the checkout is split from its cart and kept for Checkouts.standaloneLifetime instead, so a later payment result still completes it into an order. See from cart to order.
Per environmentNo

Checkouts.standaloneLifetime

Admin labelNot shown in the admin
TypeNumber, in seconds
Default31536000 (365 days)
EffectHow long a checkout split from its cart is kept after its last change. A checkout is split when a payment is sent whose result comes later: an authentication challenge, a redirect to the provider, a pending payment or a partial payment. The paid-for items leave the cart, which keeps anything else, and the checkout waits on its own for the result. That result can arrive days later, by webhook, and still completes the checkout into an order; see webhooks. The clean-up job deletes split checkouts older than this, separately from ordinary ones.
Per environmentNo

Checkouts.defaultCheckoutType

Admin labelNot shown in the admin
TypeText
Defaultsingle
EffectThe checkout POST /checkout starts: single, the single-page checkout. Keep the default.
Per environmentNo

Orders

Orders.orders.numberTemplate

Admin labelOrder number template
TypeText
Default{SEQ}
EffectThe pattern for order numbers. {SEQ} is the sequence, {SEQ:6} pads it to six digits, and {DATE} is today as 20261005, which restarts the sequence every day. Changing the template starts the sequence again at 1. Include {SEQ} in every template: it is the part that makes each order number unique. See order numbers.
Per environmentOptional. A different prefix on staging keeps its order numbers from being mistaken for real ones

Orders.orders.metadataFieldListing

Admin labelMetadata Fields
TypeSeveral order metadata fields
DefaultNone
EffectWhich order metadata fields appear as columns in the admin's list of orders, such as a purchase-order number. It changes nothing on the website or in the API.
Per environmentNo

Shipping

Shipping.defaultShippingCategory

Admin labelDefault shipping category
TypeOne shipping category
DefaultNone
EffectThe shipping category used for a product that has none; a variant uses its parent's. A shipping method offers rates for an order when every item's shipping category, its own or this default, is among the method's categories, so set a default to cover products without one. See why a method does not appear.
Per environmentNo

Shipping.rates.lifetime

Admin labelLifetime, under Rate settings
TypeNumber, in seconds
Default3600 (one hour)
EffectHow long a shipping rate is valid after it is created. A checkout is ready for payment while its selected rate is valid, so create shipping again for a shopper who comes back after longer than this; see rate lifetime.
Per environmentNo

Taxes

Taxes.enabled

Admin labelEnabled
TypeSwitch
DefaultOff
EffectOff, no tax is calculated: tax totals are zero, and nothing is sent to a provider after payment. On, every checkout is taxed by a provider; set the default warehouse and the default provider (below) before switching it on.
Per environmentNo

Taxes.defaultWarehouse

Admin labelDefault warehouse
TypeOne warehouse
DefaultNone
EffectIts address is the origin (ship-from) address in a tax calculation when no other warehouse is given, and the destination too when the zone resolves to the warehouse. With tax on, choose a warehouse that has an address.
Per environmentNo

Taxes.fallbackProvider

Admin labelDefault provider
TypeOne tax provider
DefaultNone
EffectThe provider that taxes an address no tax zone matches. Set it to an enabled provider whenever tax is on, so every address has one; the message "Could not determine tax provider" means an address matched no zone and found no default provider. See the tax providers.
Per environmentYes: a sandbox or test provider on staging, the live provider on production. Check it after any copy of settings between environments

Taxes.zoneAddress

Admin labelZone resolves to
TypeSelect: shipping (Shipping address), billing (Billing address), warehouse (Warehouse address)
Defaultshipping
EffectWhich address chooses the tax zone and is sent to the provider as the destination. shipping is the delivery address sent with the shipping call, or the checkout's delivery address before shipping exists. With billing, send the billing address early in the checkout, before shipping.
Per environmentNo

Taxes.pricingIncludesTax

Admin labelPricing includes tax
TypeSwitch
DefaultOff
EffectTells the tax provider, with every calculation, that catalogue prices already include tax. See inclusive prices.
Per environmentNo

Products

Products.defaultCurrency

Admin labelDefault currency
TypeOne currency
DefaultUS Dollar
EffectThe currency every product is priced in first. It is always one of the supported currencies, and GET /cdna-api/common/currency/default returns it.
Per environmentNo. Set it before any prices are entered

Products.supportedCurrencies

Admin labelSupported pricing currencies
TypeSeveral currencies
DefaultNone, so the default currency only
EffectThe currencies prices can be given in, in addition to the default, which is always included. GET /cdna-api/common/currencies/supported lists them. A cart's currency is set when its first item is added, and a product joins a cart when it has a price in the cart's currency; see currencies.
Per environmentNo

Products.multiCurrency

Admin labelUse multi currency for products
TypeSwitch
DefaultOff
EffectShows a price per currency in the product editor. It changes only the admin form: switching it off keeps the prices already entered, and the cart prices from whatever is stored.
Per environmentNo

Products.useTags

Admin labelUse tags for products
TypeSwitch
DefaultOn
EffectShows the tags field in the product editor. Switching it off keeps existing tags.
Per environmentNo

Products.generateInSitemap

Admin labelGenerate products in sitemap
TypeSwitch
DefaultOn
EffectWhether products are listed in the generated sitemap.
Per environmentNo

Products.interest.allowGuests

Admin labelAllow guests to register interest in products, under Expression of interest
TypeSwitch
DefaultOff
EffectOn, a visitor with no account can register interest in a product with an email address. An address the site does not know gets a new person record; an address that belongs to an account is refused, and the visitor signs in instead. See back-in-stock requests.
Per environmentNo

Products.interest.groups

Admin labelGroups for people registering interest, under Expression of interest
TypeSeveral groups
DefaultNone
EffectThe groups a person created by an expression of interest is added to. People who already exist keep their groups.
Per environmentNo

Products.interest.recaptcha

Admin labelreCAPTCHA for guests registering interest, under Expression of interest
TypeSelect: disabled (Disabled), checkbox (v2 Checkbox), invisible (v2 Invisible)
Defaultcheckbox
EffectThe reCAPTCHA v2 mode for a guest registering interest; a signed-in member is never challenged. The product page receives the widget's settings as _recaptcha, and the site's form renders the widget for guests and posts its token as g-recaptcha-response.
Per environmentNo. The reCAPTCHA keys are environment configuration, set by Core dna

Products.interest.stockThreshold

Admin labelStock threshold for back in stock notifications, under Expression of interest
TypeNumber
Default0
EffectA product fires its BackInStock event when its available stock, summed across every warehouse, rises above this quantity. A job on the event emails the people waiting for the product; see when stock comes back.
Per environmentNo

Discounts

Discounts.quantityCountScope

Admin labelOrder quantity counting scope for discount conditions
TypeSelect: all (All currencies), currency (Active cart currency only)
Defaultall
EffectWhether a discount's or code's maximum uses, and order-count conditions, count across all currencies or only in the cart's currency. Amount thresholds always count only in the cart's currency. Uses are counted from checkouts as well as orders, so an open checkout holds a use until it ends.
Per environmentNo

Configured elsewhere

A store also depends on settings outside the commerce modules:

  • Globals.security.cspPolicy, "CSP policy" under Globals › Security. Default script-src 'self' https://cdnjs.cloudflare.com 'nonce-%nonce%'. Add Stripe's and PayPal's script hosts to it, keeping the %nonce% placeholder. See Content Security Policy.
  • Environment configuration, set by Core dna for each environment, not in the admin, and never readable from a template: the platform's Stripe keys (Environment.stripe.test.* and Environment.stripe.live.*, chosen by a Stripe payment method's Test Mode), the PayPal Donate salt (Environment.paypalDonate.salt), which PayPal Donate uses, and the reCAPTCHA v2 keys (Environment.recaptcha.v2.*).
  • Payment methods and tax providers are records, not settings. Their fields are on the provider reference.
Go deeper

Was this page helpful?

Your answer goes to the docs team.