Get All Addresses
Promise<ShopifyCustomerAddress[]>
Add Address
Returns
Promise<ShopifyCustomerAddress>
Update Address
Returns
Promise<ShopifyCustomerAddress>
Delete Address
Promise<void>
Set Default Address
Promise<ShopifyCustomer>
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Manage customer shipping addresses
openbridge.customer.addresses()
const addresses = await openbridge.customer.addresses()
Promise<ShopifyCustomerAddress[]>
openbridge.customer.addAddress(address)
| Param | Type | Description |
|---|---|---|
address | AddressInput | Address details |
Promise<ShopifyCustomerAddress>
openbridge.customer.updateAddress(addressId, address)
| Param | Type | Description |
|---|---|---|
addressId | string | Address ID to update |
address | AddressInput | New address details |
Promise<ShopifyCustomerAddress>
openbridge.customer.deleteAddress(addressId)
Promise<void>
openbridge.customer.setDefaultAddress(addressId)
Promise<ShopifyCustomer>
| Field | Type | Description |
|---|---|---|
address1 | string | Street address |
address2 | string | Apt, suite, etc. |
city | string | City |
company | string | Company name |
country | string | Country |
firstName | string | First name |
lastName | string | Last name |
phone | string | Phone number |
province | string | State/Province |
zip | string | Postal code |
const addresses = await openbridge.customer.addresses()
addresses.forEach(addr => {
console.log(addr.formatted.join('\n'))
})
const newAddress = await openbridge.customer.addAddress({
firstName: 'John',
lastName: 'Doe',
address1: '123 Main St',
city: 'New York',
province: 'NY',
zip: '10001',
country: 'United States'
})
console.log(`Added address: ${newAddress.id}`)
document.querySelector('#address-form').addEventListener('submit', async (e) => {
e.preventDefault()
const formData = new FormData(e.target)
const addressId = formData.get('addressId')
const address = {
firstName: formData.get('firstName'),
lastName: formData.get('lastName'),
address1: formData.get('address1'),
address2: formData.get('address2'),
city: formData.get('city'),
province: formData.get('province'),
zip: formData.get('zip'),
country: formData.get('country'),
phone: formData.get('phone')
}
if (addressId) {
await openbridge.customer.updateAddress(addressId, address)
} else {
await openbridge.customer.addAddress(address)
}
showSuccess('Address saved!')
})
async function makeDefault(addressId) {
await openbridge.customer.setDefaultAddress(addressId)
showToast('Default address updated')
}
async function removeAddress(addressId) {
if (confirm('Delete this address?')) {
await openbridge.customer.deleteAddress(addressId)
refreshAddressList()
}
}