View Setting
view_setting outputs settings values stored in CartThrob backend configuration.
This tag accepts setting names as parameters. Use setting_name="yes" (or any truthy value) to output the value for that setting.
Each tag call returns a single value. If you pass multiple truthy setting parameters, the tag returns the first matching one it processes, so using one setting parameter per call is recommended.
This is useful for outputting globally configured values such as default region/location pieces, number-format characters (prefix, decimal point, thousands separator), checkout-page settings, and other store-level settings used across templates.
Only common keys are listed on this page. In practice, this tag can output many scalar/string CartThrob config values by key. If a setting is not listed below, check cartthrob/config/config.php and use that key name with a truthy value.
This tag is an immediate-output single tag (not a form tag).
See also:
Parameters
Pass the setting key as a parameter name with a truthy value (for example yes).
Example pattern:
{exp:cartthrob:view_setting store_name="yes"}
Only one value is returned per tag call, so use a single setting parameter per tag for predictable output.
Common keys and aliases:
- prefix
- thousands_separator
- decimal_point
- decimal_precision
- country_code
- zip
- state
- region
- currency_code
- shipping_option
- Generic setting keys
prefix
Number-format currency prefix.
Aliases:
prefixnumber_prefixprefix=”yes”
thousands_separator
Number-format thousands separator.
Aliases:
thousands_separatorthousands_septhousands_separator=”yes”
decimal_point
Number-format decimal point character.
Aliases:
decimal_pointdecimaldecimal_point=”yes”
decimal_precision
Number-format decimal precision.
decimal_precision="yes"
country_code
Default location country code from CartThrob config.
Related keys in this group:
country(same source, country code)country_codestateregionzipcountry_code=”yes”
zip
Default location ZIP/postal value.
zip="yes"
state
Default location state/region code.
state="yes"
region
Default location region value.
region="yes"
currency_code
Default number-format currency code.
currency_code="yes"
shipping_option
Currently selected cart shipping option value.
Aliases:
shipping_optionselected_shipping_optionshipping_option=”yes”
Generic setting keys
Any other setting key is looked up from CartThrob store config and returned directly.
This is how templates commonly output values such as:
store_namestore_descriptionstore_checkout_pageallow_gateway_selectionstore_phonestore_name=”yes”
Behavior and Constraints
- The tag loops through provided parameters and returns the first parameter whose value is truthy.
- If no truthy parameter is provided, output is empty.
- Aliases are normalized by the tag (for example
prefix/number_prefix,shipping_option/selected_shipping_option). shipping_optionis read from current cart shipping info; most other keys come from CartThrob store config.- For stable behavior, pass one setting key per tag call.
Examples
Output number format pieces:
{exp:cartthrob:view_setting prefix="yes"}10{exp:cartthrob:view_setting thousands_separator="yes"}000{exp:cartthrob:view_setting decimal_point="yes"}00
Output configured store name:
{exp:cartthrob:view_setting store_name="yes"}
Use configured checkout page path:
<a href="{path='store/{exp:cartthrob:view_setting store_checkout_page="yes"}'}">Checkout</a>
Conditionally show gateway selector based on config:
{if {exp:cartthrob:view_setting allow_gateway_selection="yes"}}
{exp:cartthrob:gateway_select}
{/if}