The default address data returned contains country and region codes, but not country and region names. Any one know if there's a way to do that in Spartacus, or would that be something custom?
how to get the FULL details for the current user using UserService, including their default address?
Asked
Active
Viewed 322 times
1 Answers
1
Good question! You can use Spartacus's configurable endpoint mechanism to achieve this.
For your particular case, you would want to override the addressDetail
and addresses
endpoints. You will need to add the FULL fields for country and regions your endpoints will look like this:
addresses: 'users/${userId}/addresses?fields=DEFAULT,addresses(country(FULL),region(FULL))',
addressDetail: 'users/${userId}/addresses/${addressId}?fields=country(FULL),region(FULL)',
Alternatively, you could just add fields=FULL
to receive ALL the available details.
-
1thanks @L Tiger. It worked for me :) – Anjali Rawat Oct 27 '20 at 15:30