You are here: Order System > Checkout Process > Shipping and Billing Addresses

Shipping and Billing Addresses


Addresses for an order are stored in the OrderGroup.OrderAddresses property. This property contains an OrderAddressCollection, which contains OrderAddress instances. The OrderAddress Name property is used as an identifier of each address. Shipping and billing addresses are distinguished by having different Name values. 

Addresses for a customer are stored in a similar fashion. The CustomerContact object for a user contains a ContactAddresses collection, which contains CustomerAddress instances. The CustomerContact for a user is accessible via CustomerContext.Current.GetContactForUser(). The CustomerAddress class contains similar properties to the OrderAddress class and uses the Name property as identifiers for addresses. The CustomerProfileWrapper (which  object for a user (accessible through SecurityContext.Current.CurrentUserProfile), contains two properties, PreferredBillingAddress and PreferredShippingAddress, which contain the name of the appropriate address.

An OrderAddress can be converted to a ContactAddress using StoreHelper.ConvertToCustomerAddress(); the opposite address conversion can be done with the ConvertToOrderAddress() method.

Key classes and files

OrderAddress *- Contains the properties of an address for an order.

CustomerAddress ** - Contains the properties of an address for a customer. 

OrderGroup *- Contains the collection of order addresses. 

Cart *- Inherits from OrderGroup.

PurchaseOrder *- Inherits from OrderGroup.

StoreHelper - Contains helper methods for converting addresses.

CustomerProfile - Contains profile information about a customer, like preferred shipping and billing addresses.

CustomerProfileWrapper - Extends and adds functionality to CustomerProfile class.

CustomerContact **- Contains properties of contacts like addresses, credit cards, associated organizations. 

(CMSSite/Templates/Everything/BusinessControls/CheckoutControls/SharedModules) - used in checkout by the CheckoutAddressModule.ascx (inside of CheckoutWizardModule.ascx) to create an OrderAddress.

* Metaclass. Therefore its configurable via Commerce Manager.

** Business Foundation class. Configurable via Commerce Manager.

Implementation details

Here's an example of retrieving the preferred shipping address for a customer:

CustomerContact contact = CustomerContext.Current.GetContactForUser(SecurityContext.Current.CurrentUser);
CustomerProfileWrapper customerProfile = SecurityContext.Current.CurrentUserProfile as CustomerProfileWrapper;
IEnumerable addresses = contact.ContactAddresses;
foreach (CustomerAddress ca in addresses)
if (ca.Name == customerProfile.PreferredShippingAddress)
//we have the preferred shipping address


Here's an example of retrieving a shipping address:

string shippingAddressName = cart.OrderForms[0].Shipments[0].ShippingAddressId;
OrderAddressCollection addresses = cart.OrderAddresses;
foreach (OrderAddress oa in addresses)
if (oa.Name == shippingAddressName)
//we've found the shipping address


Mediachase.Commerce.Orders - Contains OrderAddress, OrderGroup, Cart, and PurchaseOrder.

Mediachase.Commerce.Customer - Contains CustomerAddress.

Mediachase.Commerce.Customers.Profile - Contains CustomerProfile.


Version: EPiServer Commerce 1 R2 SP2| Last updated: 2012-06-29 | Copyright © EPiServer AB | Send feedback to us