Change shipping fields to billing fields. Change error message to error code in switcht statement.

This commit is contained in:
Remo Zaros
2026-05-28 09:44:33 +02:00
parent a08d0527b4
commit f458be3293

View File

@@ -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');