updateCustomerAddressesWorkflow - Medusa Core Workflows Reference
This documentation provides a reference to the updateCustomerAddressesWorkflow
. It belongs to the @medusajs/medusa/core-flows
package.
This workflow updates one or more addresses for customers. It's used by the Update Customer Address Admin API Route and the Update Customer Address Store API Route.
This workflow has a hook that allows you to perform custom actions on the updated customer addresses. For example, you can pass under additional_data
custom data that
allows you to update custom data models linked to the addresses.
You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around updating customer addresses.
Source CodeExamples#
Steps#
Workflow hook
Step conditioned by when
View step details
Input#
UpdateCustomerAddressesWorkflowInput
UpdateCustomerAddressesWorkflowInputThe data to update one or more customer addresses, along with custom data that's passed to the workflow's hooks.
UpdateCustomerAddressesWorkflowInput
UpdateCustomerAddressesWorkflowInputselector
FilterableCustomerAddressPropsThe filters to select the addresses to update.
selector
FilterableCustomerAddressPropsupdate
UpdateCustomerAddressDTOThe data to update in the addresses.
update
UpdateCustomerAddressDTOadditional_data
Record<string, unknown>OptionalAdditional data that can be passed through the additional_data
property in HTTP requests.
Learn more in this documentation.
additional_data
Record<string, unknown>Optionaladditional_data
property in HTTP requests.
Learn more in this documentation.Output#
CustomerAddressDTO[]
CustomerAddressDTO[]
CustomerAddressDTO[]
CustomerAddressDTO[]id
stringThe ID of the customer address.
id
stringis_default_shipping
booleanWhether the customer address is default shipping.
is_default_shipping
booleanis_default_billing
booleanWhether the customer address is default billing.
is_default_billing
booleancustomer_id
stringThe associated customer's ID.
customer_id
stringcreated_at
stringThe created at of the customer address.
created_at
stringupdated_at
stringThe updated at of the customer address.
updated_at
stringaddress_name
stringOptionalThe address name of the customer address.
address_name
stringOptionalcompany
stringOptionalThe company of the customer address.
company
stringOptionalfirst_name
stringOptionalThe first name of the customer address.
first_name
stringOptionallast_name
stringOptionalThe last name of the customer address.
last_name
stringOptionaladdress_1
stringOptionalThe address 1 of the customer address.
address_1
stringOptionaladdress_2
stringOptionalThe address 2 of the customer address.
address_2
stringOptionalcity
stringOptionalThe city of the customer address.
city
stringOptionalcountry_code
stringOptionalThe country code of the customer address.
country_code
stringOptionalprovince
stringOptionalThe province of the customer address.
province
stringOptionalpostal_code
stringOptionalThe postal code of the customer address.
postal_code
stringOptionalphone
stringOptionalThe phone of the customer address.
phone
stringOptionalmetadata
Record<string, unknown>OptionalHolds custom data in key-value pairs.
metadata
Record<string, unknown>OptionalHooks#
Hooks allow you to inject custom functionalities into the workflow. You'll receive data from the workflow, as well as additional data sent through an HTTP request.
Learn more about Hooks and Additional Data.
addressesUpdated#
This hook is executed after the addresses are updated. You can consume this hook to perform custom actions on the updated addresses.
Example
Input
Handlers consuming this hook accept the following input.
input
inputThe input data for the hook.
input
inputaddresses
CustomerAddressDTO[]
addresses
CustomerAddressDTO[]additional_data
Record<string, unknown> | undefinedAdditional data that can be passed through the additional_data
property in HTTP requests.
Learn more in this documentation.
additional_data
Record<string, unknown> | undefinedadditional_data
property in HTTP requests.
Learn more in this documentation.