Autofill the Country in Address Form Field
If you hide the Country form field on a Squarespace form block using CSS, you’ll get an error when you try to submit it because the country is a required field. What if you know that your clients will likely always be in the same country? Unfortunately, you can’t make the country field optional, but you can use the code below to auto-populate this field to fill in your desired country.
This also works on custom product forms.
Put the code below into Settings -> Advanced -> Code Injection.
<script> function populateCountry() { var field = document.querySelector('.field.country .field-element'); if (field) { field.value = 'United States'; } else { setTimeout(populateCountry, 500); } } populateCountry(); </script>
Customization:
To change the country, change ‘United States’ to the country of your choice.