Creating a select dropdown with all countries (with same format as Commerce)

Okay, so I got distracted by the fact that FormIt.CountryOptions has FormIt in its name, but that works like a charm:

<div class="select-wrapper">

   <label for="country">[[!%login.country]]
      <span class="error">[[+error.country]]</span>
   </label>

   <select name="country" id="country">
      [[!FormItCountryOptions?
         &selected=`[[+country]]`
      ]]
   </select>

</div>

Commerce wasn’t filling the country field, as its dropdown (just like this FormIt snippet) uses country codes and the regular user would probably just type out the name of their country.

What still persists though, is the “Additional related issue”, where Commerce doesn’t check an already existing address (which is the same like in the profile), but that’s probably something for another thread…

Edit: After deleting old duplicate addresses, everything works fine.

1 Like