CartThrob 9 documentation for ExpressionEngine commerce teams Visit CartThrob.com
CartThrob.com

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

Number-format currency prefix.

Aliases:

  • prefix
  • number_prefix

    prefix=”yes”

thousands_separator

Number-format thousands separator.

Aliases:

  • thousands_separator
  • thousands_sep

    thousands_separator=”yes”

decimal_point

Number-format decimal point character.

Aliases:

  • decimal_point
  • decimal

    decimal_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_code
  • state
  • region
  • zip

    country_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_option
  • selected_shipping_option

    shipping_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_name
  • store_description
  • store_checkout_page
  • allow_gateway_selection
  • store_phone

    store_name=”yes”

Behavior and Constraints

  1. The tag loops through provided parameters and returns the first parameter whose value is truthy.
  2. If no truthy parameter is provided, output is empty.
  3. Aliases are normalized by the tag (for example prefix/number_prefix, shipping_option/selected_shipping_option).
  4. shipping_option is read from current cart shipping info; most other keys come from CartThrob store config.
  5. 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}