Root cause identified and fixed! Problem: - WooCommerce stores enabled in TWO places: 1. $method->enabled property (what admin displays) 2. $method->instance_settings["enabled"] (what we were updating) - We were only updating instance_settings, not the property - So toggle saved to DB but $method->enabled stayed "yes" Solution: ✅ Read from $method->enabled (correct source) ✅ Update BOTH $method->enabled AND instance_settings["enabled"] ✅ Save instance_settings to database ✅ Now both sources stay in sync Evidence from logs: - Before: $method->enabled = "yes", instance_settings = "no" (mismatch!) - Toggle was reading "no", trying to set "no" → no change - update_option returned false (no change detected) After this fix: ✅ Toggle reads correct current state ✅ Updates both property and settings ✅ Saves to database correctly ✅ WooCommerce admin and SPA stay in sync
9.9 KiB
9.9 KiB