Created
May 23, 2019 08:54
-
-
Save radist2s/5dfa0bb59fe24975dc2d055c1de71cd4 to your computer and use it in GitHub Desktop.
Fix WooCommerce chosen Shipping Method during Address/ZIP code change on Form Totals update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('woocommerce_shipping_chosen_method', function ($default, $rates = [], $chosen_method = null) { | |
$rates = $rates ? (array)$rates : []; | |
if ($chosen_method and isset($rates[(string)$chosen_method])) { | |
return $chosen_method; | |
} | |
return $default; | |
}, 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment