Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save deyvi-james/c6808edf6191fd7aa8737affba98eea5 to your computer and use it in GitHub Desktop.
Save deyvi-james/c6808edf6191fd7aa8737affba98eea5 to your computer and use it in GitHub Desktop.
Disable WooCommerce's Shipping Rates Cache
// 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%'");
}
@deyvi-james
Copy link
Author

Remove shipping rates from cache, when have to refresh shipping methods depending on state or custom fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment