Address Book
The Address Book concept is a very convenient solution for the customers of your shop, that come back. Once they provide an address it is saved in the system and can be reused the next time.
Sylius handles the address book in a not complex way:
The Addresses Collection on a Customer
On the Customer entity we are holding a collection of addresses:
We can operate on it as usual - by adding and removing objects.
Besides the Customer entity has a default address field that is the default address used both for shipping and billing, the one that will be filling the form fields by default.
How to add an address to the address book manually?
If you would like to add an address to the collection of Addresses of a chosen customer that’s all that you should do:
Create a new address:
Then find a customer to which you would like to assign it, and add the address.
Remember to flush the customer’s manager to save this change.
Last updated