I’m using the Login Extra to let users create and manage their accounts. Within the update profile resource, there is (next to all other profile data also) a simple input type="text"
field to set the users country.
During the checkout in Commerce a user has either the option to enter a new address, or they can choose an existing one from a generated radio select. Now, if the user wants to add a new address in there and already has one saved in his profile, the address from the profile is loaded into the form except the country.
For some reason the country stays emtpy although there is a value for it in the users profile, so my guess is, that Commerce uses a different format to put in the country and looks for in the users profile.
(Additional related issue)
Because this whole issue of: “a user-set country is different than a Commerce-set country”, Commerce also doesn’t check an existing address in the radio select although it’s the same as within the users profile.
As Commerce is using Twig to generate the templates I can’t just go copy/paste and get the country select from there:
<div class="c-field select-wrapper {% if error_shipping_country %}error{% endif %}">
<label for="address-shipping-country">{{ lex('commerce.address.country') }}</label>
<select name="address[shipping][country]" id="address-shipping-country">
<option value=""></option>
{% for country in countries %}
<option value="{{ country.iso }}" {% if address_shipping_country == country.iso %}selected="selected"{% endif %}>{{ country.shortname }}</option>
{% endfor %}
</select>
{% if error_shipping_country %}<span class="c-field-error">{{ error_shipping_country }}</span>{% endif
</div>
So how can I replicate the same country select option in my update profile resource (created with the Login Extra) or how can I make sure the user entered country in their profile has the same format like Commerce looks for?
Thanks for any help!