Jump to content

Problems with how to make "Country" optional on checkout


Recommended Posts

In the Modern orderform, is there a way to make the "Country" optional in viewcart.tpl?

 

I am trying to force a hidden choice for users in this way:

 

<select name="country" id="country" value="US" selected="selected">

 

But that still shows an error message: Please choose your country from the drop down box

 

If there is no way to make Country optional, is there a way I can make a hidden selection for the user?

Link to comment
Share on other sites

this is how you have to make it

 

<input type="hidden" name="country" value="US"> 

 

but you will need to change countries select element name to something else, so it will not override/conflict with the hidden value

Link to comment
Share on other sites

Thanks for your advice. What happens if I just delete that entire block:

 

   <label for="country" class="control-label">{$LANG.clientareacountry}</label>
                               <select id="country" name="country" class="form-control">
                                   {foreach from=$countries key=thisCountryCode item=thisCountryName}
                                       <option value="{$thisCountryCode}" {if $thisCountryCode eq $clientsdetails.country}selected="selected"{/if}>{$thisCountryName}</option>
                                   {/foreach}
                               </select>

 

If I delete that block and use

<input type="hidden" name="country" value="US">

it still says I need to make a selection. So then I try to force it like

<input type="hidden" name="country" value="US" selected>

but it still says I need to make a selection. Is this what you mean?

Link to comment
Share on other sites

Ok I solved it. A pain in the butt. I've been using WHMCS for 4+ years and I remember 4 years ago having this same issue with "Country" not being optional.... why take so long to make this optional?

 

Here's how I solved it by removing some code and changing things around:

<!--<select id="country" name="country" class="form-control">

                                       <option value="US" selected="selected">United States</option>

                               </select>-->
<input type="hidden" name="country" value="US">

Link to comment
Share on other sites

  • 1 year later...
On 5/18/2016 at 10:00 AM, paperweight said:

Ok I solved it. A pain in the butt. I've been using WHMCS for 4+ years and I remember 4 years ago having this same issue with "Country" not being optional.... why take so long to make this optional?

 

Here's how I solved it by removing some code and changing things around:

 


<!--<select id="country" name="country" class="form-control">

                                       <option value="US" selected="selected">United States</option>

                               </select>-->
<input type="hidden" name="country" value="US">
 

Hi can you tell me what is that other things you do, because when i apply this make me mess in template.

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated