Added aggressive cache clearing after toggle. Issue: - update_option saves to DB correctly - But $method->enabled is loaded when zone object is created - Zone object is cached, so it keeps old enabled value - Next request loads cached zone with old enabled="yes" Solution: ✅ Save instance_settings to DB ✅ Delete shipping method count transient ✅ Clear shipping_zones cache (all zones) ✅ Clear specific zone cache by ID ✅ Update $method->enabled in memory ✅ Clear global shipping cache version This forces WooCommerce to: 1. Reload zone from database 2. Reload methods from database 3. Read fresh enabled value 4. Display correct state Test: Toggle should now persist correctly
10 KiB
10 KiB