You are here

function hook_commerce_customer_profile_type_info in Commerce Core 7

Defines customer profile types used to collect customer information during checkout and order administration.

Each type is represented as a new bundle of the customer information profile entity and will have a corresponding checkout pane defined for it that may be used in the checkout form to collect information from the customer like name, address, tax information, etc. Each bundle can have a default address field added by the Customer module itself with additional fields added as necessary through modules defining the types or the UI.

The Customer module defines a single customer information profile type in its own implementation of this hook, commerce_customer_commerce_customer_profile_type_info():

  • Billing information: used to collect a billing name and address from the customer for use in processing payments.

The full list of properties for a profile type is as follows:

  • type: machine-name identifying the profile type using lowercase alphanumeric characters, -, and _
  • name: the translatable name of the profile type, used as the title of the corresponding checkout pane
  • description: a translatable description of the intended use of data contained in this type of customer profile. This description will be displayed on the profile types administrative page and on the customer profiles add page.
  • help: a translatable help message to be displayed at the top of the administrative add / edit form for profiles of this type. The Drupal core help module or any module invoking hook_help needs to be enabled to take advantage of this help text.
  • addressfield: boolean indicating whether or not the profile type should have a default address field; defaults to TRUE
  • label_callback: name of the function to use to determine the label of customer profiles of this type; defaults to commerce_customer_profile_default_label
  • module: the name of the module that defined the profile type; should not be set by the hook but will be populated automatically when the pane is loaded

Return value

An array of profile type arrays keyed by type.

2 functions implement hook_commerce_customer_profile_type_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

commerce_customer_commerce_customer_profile_type_info in modules/customer/commerce_customer.module
Implements hook_commerce_customer_profile_type_info().
commerce_customer_profile_dummy_type_commerce_customer_profile_type_info in modules/customer/tests/commerce_customer_profile_dummy_type.module
Implements hook_commerce_customer_profile_type_info().
4 invocations of hook_commerce_customer_profile_type_info()
commerce_customer_configure_customer_fields in modules/customer/commerce_customer.module
Configures fields referencing customer profile types defined by enabled modules and configures the fields on those profile types if necessary.
commerce_customer_modules_disabled in modules/customer/commerce_customer.module
Implements hook_modules_disabled().
commerce_customer_profile_types in modules/customer/commerce_customer.module
Returns an array of customer profile type arrays keyed by type.
commerce_order_configure_order_fields in modules/order/commerce_order.module
Configures the customer profile reference fields attached to the default order type when modules defining customer profile types are enabled after the Order module.

File

modules/customer/commerce_customer.api.php, line 49
Hooks provided by the Customer module.

Code

function hook_commerce_customer_profile_type_info() {
  $profile_types = array();
  $profile_types['billing'] = array(
    'type' => 'billing',
    'name' => t('Billing information'),
    'description' => t('The profile used to collect billing information on the checkout and order forms.'),
  );
  return $profile_types;
}