Woocommerce Tag Delete / object cache error
-
I’m on the current version (Version 7.8.0.1) using Redis, but I think this has happened for a few versions.
This has been driving me mad, because I thought it was some custom code I had written causing the problem. I completely refactored it, then disabled it entirely, and the bug was still there.
When saving a product in WooCommerce, the product editor would reload with tags showing blank, both in the product form and the product list view. If you hit Purge All, or purged the object cache specifically, they would reappear. However, if you saved again before purging, the blank tags would be written to the database, so they were not just appearing deleted, they were actually being deleted.
This caused tags to be randomly and silently wiped, but inconsistently enough that it took weeks to diagnose. The tags were correct in the database, but Redis was serving a blank cache entry for them after save. I was trawling through logs looking for something deleting the tags, when in reality nothing was. WooCommerce was simply reading the blank Redis cache on page reload and writing that empty state back to the database on the next save.
The fix was adding
product_tag_relationshipsto Do Not Cache Groups in the object cache settings. Tags now bypass Redis entirely and are always read from the database.This is a data loss bug. Users can silently lose taxonomy data with no indication anything is wrong.
You must be logged in to reply to this topic.