Forked from chuckmo/diable_wc_shipping_rates_cache.php
Created
January 14, 2018 22:06
-
-
Save deyvi-james/c6808edf6191fd7aa8737affba98eea5 to your computer and use it in GitHub Desktop.
Disable WooCommerce's Shipping Rates Cache
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
// essentially disable WooCommerce's shipping rates cache | |
add_filter('woocommerce_checkout_update_order_review', 'clear_wc_shipping_rates_cache'); | |
function clear_wc_shipping_rates_cache(){ | |
global $wpdb; | |
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '%wc_ship%'"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remove shipping rates from cache, when have to refresh shipping methods depending on state or custom fields.