Hiding the billing address if it is already entered - xmpie-users/uStore-js GitHub Wiki

By default, uStore allows the customer to change their billing address when they checkout. In many cases, some store administrators want to prevent the customer from changing the billing address.

This JavaScript works by hiding the div that contains the billing address if a billing address has been defined:

<script type="text/javascript">
$("document").ready(function() {
  if (document.title.indexOf("Order Summary") > 1 && //we are on the order summary page 
      $("#ctl00_cphMainContentFooter_btnNext").length > 0 && //there is a next button on the page
      $("#ctl00_cphMainContent_BillingAddress_ddlAddresses").val() > 0) {  //the billing address is already set
    document.location.href = $("#ctl00_cphMainContentFooter_btnNext").attr("href");
  }
});
</script>

This provides a bit of security because uStore will not let the user checkout if there is no billing address defined, so if the administrator has forgotten to setup a billing address for a user, then the script will allow the customer to setup the billing address the first time, after that, it will be hidden and must be changed by the administrator.

For information on how to add JavaScript to your store: How to add JavaScript to a storefront.

⚠️ **GitHub.com Fallback** ⚠️