Set Config

Set Config is a special tag pair that allows you to configure certain settings on-the-fly, per customer, using conditionals. This tag has no output, and requires a page reload for it to take effect. Due to the way ExpressionEngine parses templates, CartThrob values are already loaded and set by the time templates render. If you use this tag, any effect it has will not be visible until a new page has been rendered, or the current page has been reloaded.

Table of Contents

Variables

set_price_field

Change the price custom field. Required parameters: channel, field.

{set_price_field channel="products" field="sale_price"}

set_shipping_plugin

Changes the selected shipping plugin. Required parameters: value. Use the "Parameter value for selecting this gateway dynamically" that is listed in the shipping plugin settings.

{set_shipping_plugin value="by_weight_ups_xml"}

set_customer_info

Set the customer info field. Required parameters: field and value.

{set_customer_info field="first_name"  value="Ace"}

set_CONFIG_NAME

Change "simple" config items (such as the settings found in the General Global Settings, Number Format Defaults, or Product Options tabs).

{set_number_format_defaults_prefix value="£"}

Examples

{exp:cartthrob:set_config}
{if group_id == 7}
{set_price_field channel="products" field="product_discounted_price"}
{if:else}
{set_price_field channel="products" field="product_price"}
{/if}
{/exp:cartthrob:set_config}