Skip to content

Instantly share code, notes, and snippets.

@harisrozak
Last active June 20, 2016 06:54
Show Gist options
  • Save harisrozak/3dfa72d31d60c61991b9d32431bf1455 to your computer and use it in GitHub Desktop.
Save harisrozak/3dfa72d31d60c61991b9d32431bf1455 to your computer and use it in GitHub Desktop.
<?php
// 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(){
$packages = WC()->cart->get_shipping_packages();
foreach ($packages as $key => $value) {
$shipping_session = "shipping_for_package_$key";
unset(WC()->session->$shipping_session);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment