Manage Customer Addresses in Storefront

In this document, you'll learn how to manage a customer's addresses in a storefront.

List Customer Addresses#

To retrieve the list of customer addresses, send a request to the List Customer Addresses API route:

The List Customer Addresses API route accepts pagination parameters to paginate the address.

It returns in the response the addresses field, which is an array of addresses.


Add Customer Address#

To add a new address for the customer, send a request to the Add Customer Address API route:

The Add Address API route returns in the response a customer field, which is a customer object.


Edit an Address#

To edit an address, send a request to the Update Customer Address API route:

The Update Address API route returns in the response a customer field, which is a customer object.


Delete Customer Address#

To delete a customer's address, send a request to the Delete Customer Address API route:

Code
1fetch(2  `http://localhost:9000/store/customers/me/addresses/${3    addrId4  }`,5  {6    credentials: "include",7    headers: {8      "x-publishable-api-key": process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY || "temp",9    },10    method: "DELETE",11  }12)13.then((res) => res.json())14.then(({ parent: customer }) => {15  // use customer...16  console.log(customer)17})

The Delete Customer Address API route returns a parent field in the response, which is a customer object.

Was this page helpful?
Edit this page
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break