Update checkout price based on selected billing country
-
Hello,
I need to update price and currency after user select billing country
add_action(‘wp_footer’, ‘billing_country_update_checkout’, 50);
function billing_country_update_checkout() {
if ( ! is_checkout() ) return;
?>
<script type=”text/javascript”>
jQuery(function($){
$(‘select#billing_country, select#shipping_country’).on( ‘change’, function (){
document.getElementById(‘totalSum’).innerHTML = ‘<?php echo WC()->cart->get_cart_contents_total(); ?>’;
});
});
</script>
<?php
}So far I did this ^, but price is all the time the same.. Price isn’t adequate to selected country (I’ve set prices manually for each pricing zone). Any ideas?
- The topic ‘Update checkout price based on selected billing country’ is closed to new replies.