Same as Billing Checkbox

This code will allow you to add a box to your form that automatically duplicates the Billing information for use in the Shipping fields. This will save your customers some time while filling out the form.

When complete, the checkbox will look like this:

Same as Billing

HTML

Search for "Shipping Information". It should take you to a portion of code that looks like this:

<div class="form-group row pf-section-header bg-primary">
  <label class="h4 col-xs-12 col-form-label">Shipping Information</label>
  <div class="section-description">
  </div>
</div>

Add the following code to the next line:

<div class="form-group">
  <span class="col-form-label col-sm-4 col-xs-12 ">Same as Billing</span>
  <div class="col-md-8 col-xs-12 ">
   <div class="checkbox">
    <label>
      <input type="checkbox" name="shipsameasbill" size="28" value="yes" onClick="copyBillingToShipping()">
    </label>
   </div>
  </div>
</div>

Javascript

Next, locate this section:

<script type="text/javascript">
     var submitted = false;
     function submitform()
     {
       if(submitted) {
         return false;
       }
       submitted=true;
       document.epayform.submitbutton.value='Please Wait... Processing';
       return true;
     }
   </script>

Insert a new line directly below and add the following code:

<script type="text/javascript">
      function copyBillingToShipping()
      {
        var form = document.epayform;
        if(form.shipsameasbill.checked)
        {
          form.UMshipcompany.value=form.UMbillcompany.value;
          form.UMshipfname.value=form.UMbillfname.value;
          form.UMshiplname.value=form.UMbilllname.value;
          form.UMshipcompany.value=form.UMbillcompany.value;
          form.UMshipstreet.value=form.UMbillstreet.value;
          form.UMshipstreet2.value=form.UMbillstreet2.value;
          form.UMshipcity.value=form.UMbillcity.value;
          form.UMshipstate.value=form.UMbillstate.value;
          form.UMshipzip.value=form.UMbillzip.value;
          form.UMshipcountry.value=form.UMbillcountry.value;
          form.UMshipphone.value=form.UMbillphone.value;
        }
      }
</script>

Once you have saved changes to your payment form, checking the box will instantly fill out the Shipping fields with Billing information.