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

Customer Info

{exp:cartthrob:customer_info} is a tag pair that outputs customer/session values currently stored in the cart.

It is typically used to prefill checkout/shipping forms after data has been saved by:

See also:

This tag reads cart session data. It does not read ExpressionEngine member profile custom fields directly.

Parameters

This tag has no tag-specific parameters.

Variables

customer_info outputs customer/cart variables through globalVariables().

Important behavior:

  1. Customer info values are available in two forms:
    • unprefixed: {first_name}
    • prefixed alias: {customer_first_name}
  2. Custom data is available as custom_data:* variables:
    • {custom_data:gift_note}
  3. Global cart variables (totals/counts/etc.) are also available in this pair.

Customer Field Variables

Each field below can be used as {field_name} and as {customer_field_name}.

Contact and billing fields:

  • first_name / customer_first_name
  • last_name / customer_last_name
  • address / customer_address
  • address2 / customer_address2
  • city / customer_city
  • state / customer_state
  • zip / customer_zip
  • country / customer_country
  • country_code / customer_country_code
  • company / customer_company
  • region / customer_region
  • phone / customer_phone
  • email_address / customer_email_address
  • ip_address / customer_ip_address
  • description / customer_description
  • use_billing_info / customer_use_billing_info

Shipping fields:

  • shipping_first_name / customer_shipping_first_name
  • shipping_last_name / customer_shipping_last_name
  • shipping_phone / customer_shipping_phone
  • shipping_address / customer_shipping_address
  • shipping_address2 / customer_shipping_address2
  • shipping_city / customer_shipping_city
  • shipping_state / customer_shipping_state
  • shipping_zip / customer_shipping_zip
  • shipping_country / customer_shipping_country
  • shipping_country_code / customer_shipping_country_code
  • shipping_company / customer_shipping_company
  • shipping_region / customer_shipping_region
  • shipping_option / customer_shipping_option

Payment/checkout context fields:

  • CVV2 / customer_CVV2
  • card_type / customer_card_type
  • expiration_month / customer_expiration_month
  • expiration_year / customer_expiration_year
  • begin_month / customer_begin_month
  • begin_year / customer_begin_year
  • bday_month / customer_bday_month
  • bday_day / customer_bday_day
  • bday_year / customer_bday_year
  • currency_code / customer_currency_code
  • language / customer_language
  • weight_unit / customer_weight_unit
  • gateway / customer_gateway
  • po_number / customer_po_number
  • card_code / customer_card_code
  • issue_number / customer_issue_number
  • transaction_type / customer_transaction_type
  • bank_account_number / customer_bank_account_number
  • bank_account_name / customer_bank_account_name
  • bank_name / customer_bank_name
  • check_type / customer_check_type
  • account_type / customer_account_type
  • routing_number / customer_routing_number
  • success_return / customer_success_return
  • cancel_return / customer_cancel_return

Member-related fields (cart customer-info defaults):

  • username / customer_username
  • screen_name / customer_screen_name

Legacy anchors retained for compatibility:

  • customer_password (not part of current default customer-info output)
  • customer_password_confirm (not part of current default customer-info output)
  • customer_create_member (not part of current default customer-info output)
  • customer_group_id (not part of current default customer-info output)

Custom data:

  • custom_data:your_data_field_name

Example:

{custom_data:your_data_field_name}

Behavior and Constraints

  1. customer_info renders one parsed row from globalVariables().
  2. Values come from cart session/customer info defaults and saved cart custom data.
  3. Values are updated by CartThrob actions/forms that call save_customer_info().
  4. If a value has never been saved, it is usually an empty string.
  5. custom_data:* values are available when those keys have been saved (missing keys resolve to empty when referenced).

Examples

Prefill shipping fields in a checkout form

{exp:cartthrob:customer_info}
    <input type="text" name="shipping_first_name" value="{customer_shipping_first_name}" />
    <input type="text" name="shipping_last_name" value="{customer_shipping_last_name}" />
    <input type="text" name="shipping_zip" value="{customer_shipping_zip}" />
{/exp:cartthrob:customer_info}

Use unprefixed aliases (same values)

{exp:cartthrob:customer_info}
    <p>{first_name} {last_name}</p>
    <p>{email_address}</p>
{/exp:cartthrob:customer_info}

Prefill selected gateway

{exp:cartthrob:customer_info}
    {exp:cartthrob:gateway_select id="gateway" selected="{gateway}"}
{/exp:cartthrob:customer_info}

Output custom data

{exp:cartthrob:customer_info}
    <p>Gift note: {custom_data:gift_note}</p>
{/exp:cartthrob:customer_info}