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:
- Customer info values are available in two forms:
- unprefixed:
{first_name} - prefixed alias:
{customer_first_name}
- unprefixed:
- Custom data is available as
custom_data:*variables:{custom_data:gift_note}
- 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_namelast_name/customer_last_nameaddress/customer_addressaddress2/customer_address2city/customer_citystate/customer_statezip/customer_zipcountry/customer_countrycountry_code/customer_country_codecompany/customer_companyregion/customer_regionphone/customer_phoneemail_address/customer_email_addressip_address/customer_ip_addressdescription/customer_descriptionuse_billing_info/customer_use_billing_info
Shipping fields:
shipping_first_name/customer_shipping_first_nameshipping_last_name/customer_shipping_last_nameshipping_phone/customer_shipping_phoneshipping_address/customer_shipping_addressshipping_address2/customer_shipping_address2shipping_city/customer_shipping_cityshipping_state/customer_shipping_stateshipping_zip/customer_shipping_zipshipping_country/customer_shipping_countryshipping_country_code/customer_shipping_country_codeshipping_company/customer_shipping_companyshipping_region/customer_shipping_regionshipping_option/customer_shipping_option
Payment/checkout context fields:
CVV2/customer_CVV2card_type/customer_card_typeexpiration_month/customer_expiration_monthexpiration_year/customer_expiration_yearbegin_month/customer_begin_monthbegin_year/customer_begin_yearbday_month/customer_bday_monthbday_day/customer_bday_daybday_year/customer_bday_yearcurrency_code/customer_currency_codelanguage/customer_languageweight_unit/customer_weight_unitgateway/customer_gatewaypo_number/customer_po_numbercard_code/customer_card_codeissue_number/customer_issue_numbertransaction_type/customer_transaction_typebank_account_number/customer_bank_account_numberbank_account_name/customer_bank_account_namebank_name/customer_bank_namecheck_type/customer_check_typeaccount_type/customer_account_typerouting_number/customer_routing_numbersuccess_return/customer_success_returncancel_return/customer_cancel_return
Member-related fields (cart customer-info defaults):
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:
Example:
{custom_data:your_data_field_name}
Behavior and Constraints
customer_inforenders one parsed row fromglobalVariables().- Values come from cart session/customer info defaults and saved cart custom data.
- Values are updated by CartThrob actions/forms that call
save_customer_info(). - If a value has never been saved, it is usually an empty string.
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}