Clear The WooCommerce Shipping Rate Cache

WooCommerce has a performance feature where it caches (saves) shipping rate information for future use in-order speed up system performance and reduce the workload. That's great and all, except that the ‘clear transients' and ‘clear cache' buttons inside of WooCommerce do NOT delete the WooCommerce shipping rate cache; it does clear all other caches and you can even delete active cart sessions, though the shipping rates will never be touched.

When you clear the cache from inside of WooCommerce you can expect it to clear everything right? Especially since it says so! Alas it does not. Even if you enable shipping debugging it will STILL cache shipping rates even though it's specifically not supposed to. It's a horrible bug in WooCommerce but thankfully there is a way around this.

If you've tried the following and your shipping rates still don't update properly check the next sections:

  • Inside of WooCommerce -> System Status -> Tools, you've checked “Shipping Debug Mode”.
  • You've clicked:
    • Clear transients
    • Clear expired transients
    • Clear all sessions
  • Cleared your browser cache and/or used a Private (incognito mode in Chrome, Private Browsing in Firefox) mode in your browser

The Reason:

The reason the WooCommerce shipping rate cache is not cleared is because of a bug in WooCommerce (or maybe even in WordPress) where it does not delete the proper data from the database. I found this out thanks to Spencer Bean where he wrote on his blog about exactly this, so all credit to this solution goes to him. He wrote the blog post Manually Purging WooCommerce Shipping Rate Cache.

Clearing all those caches does not delete the wc_shipping data rows as it should. Don't know why. Thankfully Spencer had the answer.

The (quick) solution:

Fair warning, this is a manual solution. Though here are the quick steps to get rid of the current WooCommerce shipping rate cache:

  1. Log into your websites database (usually done through your webhost using PhpMyAdmin).
  2. Find the “wp_options” table for your site.
  3. Find all rows in the wp_options table using the LIKE operation to find wc_ship. Using PhpMyAdmin this can be done by selecting the wp_options table and then clicking “Search” on the top menu bar, then entering “%wc_ship%” into the “option_name” field.
  4. Select all of the rows, and delete them.

That's it. That'll clear the WooCommerce shipping rate cache and allow you to retrieve all new shipping rates. Once you get some shipping rates, this cache will be filled up again so if you'd like to get fresh rates you'll have to go through the steps above again.

Video tutorial!

If you'd like some visual guidance on how to accomplish this, I made a short 3 minute (and 3 second) video. It'll show you exactly how to get this done.

  • Hi Piotr, thanks for the info regarding the Shipping in WooCommerce, do you know if WordPress/WooCommerce have fixed this issue yet? I’m having issues and trying to ascertain if it is my UPS Shipping Plugin causing the issues, or WP/Woo instead. Many thanks.

    • Hey David,

      Alas I haven’t even seen this issue to be on their radar, thus as far as I know: no, they haven’t addressed this issue. Bummers.

      If you’re having the same issue that I had, then it’s a combo of both causing the issue. Mostly Woo though. It’s caching the addresses and not letting the cache go at all. It’s just writing to the database and never deleting it.

      I understand the point of caching address searches: it can really speed things up! But … there REALLY needs to be a way to clear that cache once in a while, especially when things go wrong.

      The way mentioned in the article is the only way I know of to ‘fix’ it (temporarily). 🙁

  • >