updateCustomersWorkflow - Medusa Core Workflows Reference
This documentation provides a reference to the updateCustomersWorkflow
. It belongs to the @medusajs/medusa/core-flows
package.
This workflow updates one or more customers. It's used by the Update Customer Admin API Route and the Update Customer Store API Route.
This workflow has a hook that allows you to perform custom actions on the updated customer. For example, you can pass under additional_data
custom data to update
custom data models linked to the customers.
You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around updating customers.
Source CodeExamples#
Steps#
Workflow hook
Step conditioned by when
View step details
Input#
UpdateCustomersWorkflowInput
UpdateCustomersWorkflowInputThe data to update one or more customers, along with custom data that's passed to the workflow's hooks.
UpdateCustomersWorkflowInput
UpdateCustomersWorkflowInputselector
FilterableCustomerPropsThe filters to select the customers to update.
selector
FilterableCustomerPropsupdate
CustomerUpdatableFieldsThe data to update in the customers.
update
CustomerUpdatableFieldsadditional_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#
CustomerDTO[]
CustomerDTO[]
CustomerDTO[]
CustomerDTO[]id
stringThe ID of the customer.
id
stringemail
stringThe email of the customer.
email
stringhas_account
booleanA flag indicating if customer has an account or not.
has_account
booleandefault_billing_address_id
null | stringThe associated default billing address's ID.
default_billing_address_id
null | stringdefault_shipping_address_id
null | stringThe associated default shipping address's ID.
default_shipping_address_id
null | stringcompany_name
null | stringThe company name of the customer.
company_name
null | stringfirst_name
null | stringThe first name of the customer.
first_name
null | stringlast_name
null | stringThe last name of the customer.
last_name
null | stringaddresses
CustomerAddressDTO[]The addresses of the customer.
addresses
CustomerAddressDTO[]phone
null | stringThe phone of the customer.
phone
null | stringgroups
object[]The groups of the customer.
groups
object[]metadata
Record<string, unknown>Holds custom data in key-value pairs.
metadata
Record<string, unknown>created_by
null | stringWho created the customer.
created_by
null | stringdeleted_at
null | string | DateThe deletion date of the customer.
deleted_at
null | string | Datecreated_at
string | DateThe creation date of the customer.
created_at
string | Dateupdated_at
string | DateThe update date of the customer.
updated_at
string | DateHooks#
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.
customersUpdated#
Handlers consuming this hook accept the following input.
invoke
InvokeFn<object, TOutput, TCompensateInput>