Make address fields populate dynamic.
This commit is contained in:
@@ -386,14 +386,14 @@ function modify_checkout_with_js()
|
|||||||
}
|
}
|
||||||
$data = get_PPPR_data();
|
$data = get_PPPR_data();
|
||||||
|
|
||||||
$city = $data["city"];
|
$city = esc_js($data["city"]);
|
||||||
$postcode = $formatted_postcode = preg_replace(
|
$postcode = esc_js( preg_replace(
|
||||||
"/(\d+)([A-Z]+)/",
|
"/(\d+)([A-Z]+)/",
|
||||||
'$1 $2',
|
'$1 $2',
|
||||||
strtoupper($data["postcode"]),
|
strtoupper($data["postcode"])
|
||||||
);
|
));
|
||||||
$address =
|
$address =
|
||||||
$data["street"] . " " . strtoupper($data["house_number"]);
|
esc_js($data["street"] . " " . strtoupper($data["house_number"]));
|
||||||
|
|
||||||
echo <<<HTML
|
echo <<<HTML
|
||||||
<script type="text/javascript" id="set_pppr_fields">
|
<script type="text/javascript" id="set_pppr_fields">
|
||||||
@@ -406,11 +406,11 @@ function modify_checkout_with_js()
|
|||||||
wp.data.dispatch(store).setShippingAddress({
|
wp.data.dispatch(store).setShippingAddress({
|
||||||
first_name: '',
|
first_name: '',
|
||||||
last_name: '',
|
last_name: '',
|
||||||
address_1: 'Tjeuke Timmermansstraat 43',
|
address_1: '{$address}',
|
||||||
address_2: '',
|
address_2: '',
|
||||||
city: 'Tilburg',
|
city: '{$city}',
|
||||||
state: '',
|
state: '',
|
||||||
postcode: '5041 EK',
|
postcode: '{$postcode}',
|
||||||
country: 'NL',
|
country: 'NL',
|
||||||
phone: '',
|
phone: '',
|
||||||
email: ''
|
email: ''
|
||||||
|
|||||||
Reference in New Issue
Block a user