0

I am using Expresso Store V1 and I would like the Shipping Same as Billing to default to unticked. Is this possible?

Form html:

<div class="control-group">
    <div class="controls">
            <label for="shipping_same_as_billing" class="checkbox">
                {field:shipping_same_as_billing} Same as Billing Details
            </label>
    </div>
</div>

Script:

<script type="text/javascript">
        $(function() {
            $('#shipping_same_as_billing').change(function() {
                if (this.checked) {
                    $('#shipping_details_drawer').slideUp();
                } else {
                    $('#shipping_details_drawer').slideDown();
                }
            });
            if ($('#shipping_same_as_billing').is(':checked')) {
                $('#shipping_details_drawer').hide();
            }
        });
</script>
0

As example from the Docs, don't use the default tag, but the actual rendered html:

<div class="control-group">
  <div class="controls">
    <label for="shipping_same_as_billing" class="checkbox">
      <input type="hidden" name="shipping_same_as_billing" value="0" />
      <input type="checkbox" id="shipping_same_as_billing" name="shipping_same_as_billing" value="0" {shipping_same_as_billing_checked} />
  Same as Billing Details
    </label>
  </div>
</div>

You have to have the hidden one, so when the checkbox is unchecked it still sends a value with the form. So the second input (the checkbox one) has the default value of 0 so unchecked by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.