Page 1 of 1

State/Region preselected on checkout page

Posted: Wed Dec 21, 2016 2:13 am
by brussell
Hi,

Version: OC 2.2.0

The state/region dropdowns under the Payment and Shipping Address areas have been preselected with the state/region that has been defined under Settings > Local.

The problem with this is that some customers are forgetting to select their region/state and so an order will come through showing the wrong region/state.

Is there a way to change this so that the 'Please Select' option is default? This way, it will force the customer to select their state/region.

Thanks to anyone who can help with this

Brett

Re: State/Region preselected on checkout page

Posted: Wed Dec 21, 2016 11:30 am
by IP_CAM
I am not really sure about your wishes, but check the image, for a possible fix.
It's untested, I don't know, how your Customers are exactly able to check out...
Ernie

Re: State/Region preselected on checkout page

Posted: Wed Dec 21, 2016 7:35 pm
by paulfeakins

Re: State/Region preselected on checkout page

Posted: Wed Dec 21, 2016 11:15 pm
by brussell
Thanks for helping guys. That solved the issue @IP_CAM, thank you :)

Re: State/Region preselected on checkout page

Posted: Mon Jan 30, 2017 8:31 am
by websiteworld
For Opencart 2.3 comment out lines 324-326 of shipping_address.tpl

Code: Select all

//					if (json['zone'][i]['zone_id'] == '<?php echo $zone_id; ?>') {
//						html += ' selected="selected"';
//					}

Re: State/Region preselected on checkout page

Posted: Wed May 08, 2019 5:16 pm
by stavrosa
Thanks @IP_CAM

For Journal2 same lines on
catalog/view/theme/journal2/template/journal2/checkout/address_form.tpl

Re: State/Region preselected on checkout page

Posted: Thu Jun 06, 2019 8:15 pm
by stavrosa
Do we have an update on this for OC3?

catalog/view/theme/journal3/template/journal3/checkout/address.twig
the twig code for journal3 goes like this:

Code: Select all

 
      <div class="form-group required address-zone">
        <label class="control-label" for="input-{{ type }}-zone">{{ entry_zone }}</label>
        <select v-model="order_data.{{ type }}_zone_id" v-on:change="save()" name="zone_id" id="input-{{ type }}-zone" class="form-control">
          <option v-if="{{ type }}_zones.length > 0" value="">{{ text_select }}</option>
          <option v-if="{{ type }}_zones.length == 0" value="">{{ text_none }}</option>
          <option v-for="zone in {{ type }}_zones" v-bind:value="zone.zone_id" v-html="zone.name"></option>
        </select>
        <span class="text-danger" v-if="error && error.{{ type }}_zone" v-html="error.{{ type }}_zone"></span>
       </div>
EDIT:
Solution: Just comment the last option, seems to be working fine (same on country too)

Code: Select all

<!--option v-for="zone in {{ type }}_zones" v-bind:value="zone.zone_id" v-html="zone.name"></option-->

Re: State/Region preselected on checkout page

Posted: Sun Dec 01, 2019 9:12 pm
by Zanato
stavrosa wrote:
Thu Jun 06, 2019 8:15 pm
Do we have an update on this for OC3?

Solution: Just comment the last option....
There is a much easier solution...

Go to Admin > System > Settings > Edit your Store > Local Tab...

and just leave Region / State on "---Please Select---".

No need to edit core files. This is tested on OC3. Not sure if it works for older versions but seeing as this thread features high on Google for searching this problem, I'll post it here.