Skip to main content
Version: 2.0.0

CustomerAddressesQuery

Description

Returns the address book for the authenticated customer. The operation name is allCustomerAddresses.

This query supports both customer storage modes used by the plugin:

  • Craft Pro customer addresses
  • plugin-managed customer address book

The response is normalized into one common list so frontend/admin tooling can render it consistently.

Endpoint

query allCustomerAddresses {
allCustomerAddresses {
totalCount
items {
id
name
firstname
lastname
telephone
street
city
postcode
country_code
}
}
}

Arguments

This query does not accept arguments.

Authentication

Requires authenticated GraphQL user context.
If no valid user is resolved, the query fails through the plugin auth guard.

Return Values

Returns an AddressList object:

FieldTypeDescription
totalCountIntNumber of addresses returned in items.
items[YuiAddress]Address rows in normalized structure.

Each YuiAddress item includes:

FieldTypeDescription
idIntAddress identifier when available.
nameStringFull display name.
firstnameStringFirst name.
lastnameStringLast name.
telephoneStringPhone number.
streetStringStreet line(s) flattened into one string.
cityStringCity.
postcodeStringPostal code.
country_codeStringCountry code.
companyStringCompany name (if present).
identification_numberStringOptional company/person identifier.
tax_identification_numberStringOptional tax identifier.

Usage Example

query {
allCustomerAddresses {
totalCount
items {
id
firstname
lastname
street
city
postcode
country_code
}
}
}

Notes

  • The plugin resolves addresses from the active customer mode automatically.
  • Response can include both billing and shipping address entries when both exist.
  • Use saveAddress mutation to create/update items and then re-run this query.