I’m after a strategy to refresh all the checkout web page as soon as the Metropolis has been entered.
After many Google searches I’m conscious that that is an odd request as WordPress updates the delivery charges and many others as soon as the handle is entered nevertheless, I’ve a plugin that’s for supply dates and it’s typically not displaying the proper days till you refresh the web page.
I’m considering I might use a operate like:
operate f_refreshpage() {
header('Location: '.$_SERVER['REQUEST_URI']);
}
I then tried so as to add it to my customised metropolis dropdown record area:
operate city_dropdown( $fields ) {
$city_args = wp_parse_args( array(
'kind' => 'choose',
'choices' => array(
'Please Choose'=>'Please Choose',
'Possibility 1'=>'Possibility 1',
'Possibility 2'=>'Possibility 2',
'Possibility 3'=>'Possibility 3',
),
'class' => array ('address-field', 'update_totals_on_change','f_refreshpage')
), $fields['shipping']['shipping_city'] );
$fields['shipping']['shipping_city'] = $city_args;
$fields['billing']['billing_city'] = $city_args; // Additionally change for billing area
return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'city_dropdown' );
However clearly, I have never accomplished that proper or I would not be asking on right here!
Any help can be significantly appreciated 🙂
Cheers,