Currently, the first address line is used it identify the address book entry.
For companies, you often have the same "Address 1" content for different addresses.

It should be great if we had an additional field to allow us to choose the address name used in the dropdown and in the address book.


zhilchenko’s picture

Status:Active» Needs review
new2.71 KB

Here is quick patch with such functionality. Apply it, go to admin/commerce/config/addressbook and select field for entry title. Users on checkout will see select box with this field values.

DuaelFr’s picture

Status:Needs review» Needs work

Nice start but :

  1. Billing and Shipping profile types can have different fields so we cannot use just one title field selector for both of them
  2. Creating a field and using it as address book title on existing profiles gives a select box full of untitled entries which cannot be renamed because it just creates new entries

However, good job. Thank you :)

Simon Georges’s picture

Has there been some progress on that? Is someone working on it?

jsacksick’s picture

This is currently possible via code using the hook_commerce_addressbook_labels_alter() (See commerce_addressbook.api.php).

sumaiyajaved’s picture

I am using commerce kickstart, i required a simple address so I had removed the commerce dynamic form and had added custom cck fields. Due to which the address book entry names were coming blank. I tried using the above hook in a custom module but it not change anything.

So i hacked the module :(
went to
$options[$id] = $field_values[0]['thoroughfare'];
and changed it to
$options[$id] = "Address ".$id;

I basically want the title to come from the custom cck fields. Can you help me? (name of the cck field is field_area)

kratos91’s picture

I have the same problem that sumaiyajaved, I`ve deleted the addressfield by and I want to select one of my new fields in order to appear in preovious addresses dropdown , Can you help me please ?

roball’s picture

Title:Allow the user to chosse his address book entry's name» All selectable profile names are blank if there is no "Postal address" field in the Customer profile
Version:7.x-2.x-dev» 7.x-2.0-rc7
Category:feature» bug
Priority:Normal» Major
Status:Needs work» Active
new15.36 KB
new31.08 KB

When the Billing information Customer profile type has no longer a Postal address field in it (as the default Commerce module bundle comes with), the administrative list of Customer profiles no longer contains a column "Name" (it only has "Profile ID", "User", "Type", "Status and "Operations") - see attached first screenshot.

As a consequence, on the Billing information checkout pane, the Addresses on File select list only contains empty select options - see attached second screenshot. The corresponding HTML is

<div class="form-item form-type-select form-item-customer-profile-billing-addressbook">
  <label for="edit-customer-profile-billing-addressbook">Addresses on File </label>
<select id="edit-customer-profile-billing-addressbook" name="customer_profile_billing[addressbook]" class="form-select ajax-processed"><option value="none">-- Choose --</option><option value="4" selected="selected"></option><option value="7"></option></select>
<div class="description">You may select a pre-existing address on file.</div>

Thus, the names displayed in the select options list, should not rely on other modules. Instead, it should generate its own names, maybe including the creation date. I think best would be to configure the generated name based on tokens.

candelas’s picture

same problem

LAN5’s picture

Same issue here. Any solutions known yet?

roball’s picture

Unfortunately, not yet, since the maintainer did not comment on this bug yet (beside #4, which does however not solve the blank options as by #5).

mvdve’s picture

Category:bug» feature
Priority:Major» Normal

As mentioned in #4 You can use the API of addressbook to alter the dropdown name. Simply add the function to your template.php file and select the field you want to use.

 * Allows modules to alter the list of customer profile labels.
 * During checkout the user selects the "address on file" from a dropdown list
 * of customer profiles. The label used to represent each customer profile
 * is the "thoroughfare" column of the addressfield. By altering the list
 * of labels, a module can use additional data to represent each customer
 * profile. Note that the list should always be keyed by customer profile id.
 * @param $labels
 *   An array of labels, keyed by customer profile id.
 * @param $profiles
 *   An array of customer profile entities.
function hook_commerce_addressbook_labels_alter(&$labels, $profiles) {
// No example.
roball’s picture

Thank you mvdve for the tipp, but in the meantime I have removed this module from my sites, since I am now successfully using Commerce Single Address instead. It is not causing any problems for me out of the box.

Sanco’s picture

Issue summary:View changes

After using the patch from comment #1 have errors:

Warning: array_filter() expects parameter 2 to be a valid callback, function 'addressfield_field_map_filter' not found or invalid function name в функции addressfield_tokens() (строка 207 в файле .../httpdocs/sites/all/modules/addressfield/
Warning: Invalid argument supplied for foreach() в функции addressfield_tokens() (строка 207 в файле .../httpdocs/sites/all/modules/addressfield/

How to fix?

zhilevan’s picture

I have the same problem in shipping information, customer profile select .

roball’s picture

Category:Feature request» Bug report

Unfortunately, this problem has not been considered to be fixed in the latest release (7.x-2.0-rc8). Any plans?