The site builder's guide to Ubercart Addresses

Last updated on
9 May 2017

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

The Ubercart Addresses module adds an address book to the user's profile. In the address book, users can manage their addresses: add new addresses and edit or delete existing addresses. One address must be designated as the default billing address and one must be designated as the default shipping address. This may be the same address. The default addresses cannot be deleted (but they can be edited).

The module changes the way Ubercart handles addresses. By default, Ubercart looks at a customer's previous orders and finds all unique addresses. It displays these in a select box, using the Street Address as a label. A customer who has registered but never ordered will have no contact information other than an e-mail address.

Module overview

Address book

When users visit their "My account" page, a new tab will be present: "Address book". They will be able to:

  • Add a new address
  • Edit an existing address
  • Mark one address as their default shipping address
  • Mark one address as their default billing address
  • Delete any address except the "default" addresses

Each address can be given a short "nickname". When customers checkout, they can select addresses from their address book by this name.

Checkout

When placing an order, customers will be able to:

  • Select an address from the set that appears in their address book
  • Modify the address for the order and save it as another address in their address book

The delivery and billing addresses can be prefilled with the customer's default shipping and default billing addresses. This is the default behaviour. You can change this behaviour at the "Address settings" page.

Instead of selecting an address by street name, the selector will display the address's nickname or else the entire address: Name, street1, street2, city, etc.

Warning: If pre-filling the delivery address and you charge for shipping, be sure to require that the user select a shipping method before they can place an order. Otherwise, the order may go through without shipping being charged. You may also want to use the Auto-calculate Shipping module to make things easier for your users.

Registering

When customers create an account, you can request that they be asked to provide contact information. This initial entry can be edited later.

Notes

When an user is deleted, all their addresses are also deleted.

Installation requirements

The module depends on Ubercart, Token and CTools. When you want to upgrade from Ubercart Addresses 6.x-1.0, be sure to first install CTools.

Changes to Drupal/Ubercart: technical information

The following changes are made to Drupal and Ubercart to provide the functionality:

  • A tab called "Address book" is added to the user's profile: /user.
  • The delivery and billing checkout panes provided by Ubercart are overriden.
  • The "ship to" and "bill to" order panes provided by Ubercart are overriden.
  • Delivery and billing addresses are formatted with Ubercart Addresses address formats.
  • On the user register form an address form is present: /user/register.
  • A page to configure the module is added: /admin/store/settings/addresses.
  • A page to configure Ubercart Addresses address formats is added: /admin/store/settings/countries/edit/uc_addresses_formats (Drupal 6 version) or /admin/store/settings/countries/uc_addresses_formats (Drupal 7 version).

Ubercart Addresses address formats

Ubercart Addresses comes with it's own address formats that are build by using tokens, rather than the predefined set of variables Ubercart uses. This way it's possible to add any extra address values to an address format. Note that not all addresses used in Ubercart are formatted this way. Only the following addresses are formatted by Ubercart Addresses:

  • Addresses in the address book.
  • Delivery and billing addresses on the checkout page, the order review page and the order view pages.
  • Delivery and billing addresses in the invoice Ubercart sends when the customer places an order.

Address format example for the Drupal 6 version:

[uc_addresses_company]
[uc_addresses_first_name] [uc_addresses_last_name]
[uc_addresses_street1]
[uc_addresses_street2]
[uc_addresses_city], [uc_addresses_zone_code] [uc_addresses_postal_code]
[uc_addresses_country_name_if]

Address format example for the Drupal 7 version:

[uc_addresses:company]
[uc_addresses:first_name] [uc_addresses:last_name]
[uc_addresses:street1]
[uc_addresses:street2]
[uc_addresses:city], [uc_addresses:zone:zone_code] [uc_addresses:postal_code]
[uc_addresses:country:country_name_if]

Permissions

view own default addresses
Roles with this permission can view their own default addresses in their address book.
view own addresses
Roles with this permission can view all own addresses in their address book, including the default addresses.
view all default addresses
Roles with this permission can view all default addresses of all users, including their own default addresses.
view all addresses
Roles with this permission can view all addresses of all users, including addresses of their own.
add/edit own addresses
Roles with this permission can add addresses to their own address book and edit own addresses. They are also able to view their own addresses.
add/edit all addresses
Roles with this permission can add addresses to address books of any user and edit addresses of all users. They are also be able to view all addresses.
delete own addresses
Roles with this permission can delete own addresses that are not marked as the default shipping or the default billing address. (Ubercart Addresses doesn't allow anyone to delete default addresses, including the superuser. This is by design.)
delete all addresses
Roles with this permission can delete all addresses of all users, except addresses that are marked as default shipping or default billing.

Help improve this page

Page status: No known problems

You can: