I have this code which prints the shipping country selected by the user in the woocommerce checkout page (shipping form). It works fine, the value get printed when the checkout page get loaded.
But then, if the user changes the selected country in the select list (in shipping form) the printed country value gets outdated. There is an ajax event which refresh the delivery charges, etc. But my value does not get updated.
Question: is there a way to call again the 'action' when the user makes changes in the shipping form?
<?php
add_action( 'woocommerce_checkout_before_order_review', 'action_woocommerce_checkout_before_order_review', 10, 0 );
function action_woocommerce_checkout_before_order_review () {
echo $country = WC()->customer->get_shipping_country();
}
from Refresh a printed value on some shipping field change in WooCommerce Checkout
No comments:
Post a Comment