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