Change shipping fields to billing fields. Change error message to error code in switcht statement.
This commit is contained in:
@@ -71,14 +71,14 @@ function send_postcode_data()
|
||||
console.log("Data returnd", data);
|
||||
|
||||
if (data.status === "error"){
|
||||
const err = data.message;
|
||||
const err = data.code;
|
||||
let errmsg
|
||||
|
||||
switch (err) {
|
||||
case "Huisnummer not found":
|
||||
case "HUISNUMMER_NOT_FOUND":
|
||||
errmsg = "Adres niet gevonden.";
|
||||
break;
|
||||
case "Multiple addresses match this huisnummer; add huisletter and/or huisnummertoevoeging":
|
||||
case "HUISNUMMER_AMBIGUOUS":
|
||||
errmsg = "Huisnummertovoeging mist.";
|
||||
break;
|
||||
default:
|
||||
@@ -325,7 +325,7 @@ function modify_checkout_with_js()
|
||||
if (typeof wp !== 'undefined' && wp.data && wp.data.dispatch) {
|
||||
const store = 'wc/store/cart';
|
||||
|
||||
wp.data.dispatch(store).setShippingAddress({
|
||||
wp.data.dispatch(store).setBillingAddress({
|
||||
first_name: '',
|
||||
last_name: '',
|
||||
address_1: '<?php echo esc_js($address); ?>',
|
||||
@@ -341,7 +341,7 @@ function modify_checkout_with_js()
|
||||
//make fields READONLY and ppstcode reset.
|
||||
setTimeout(() => {
|
||||
// make prefilled fiields readonly.
|
||||
$('#shipping-postcode, #shipping-city, #shipping-address_1')
|
||||
$('#billing-postcode, #billing-city, #billing-address_1')
|
||||
.prop('readonly', true)
|
||||
.css('background', '#f9f9f9');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user