Fixed the root cause identified in the audit. Issue: - toggle_method() was calling get_shipping_methods() WITHOUT false parameter - This only returned ENABLED methods by default - Disabled methods were not in the array, so toggle had no effect Solution: ✅ Line 226: get_shipping_methods(false) - gets ALL methods ✅ Simplified settings update (direct assignment vs merge) ✅ Added do_action() hook for WooCommerce compatibility ✅ Better debug logging with option key Changes: - get_shipping_methods() → get_shipping_methods(false) - Removed unnecessary array_merge - Added woocommerce_shipping_zone_method_status_toggled action - Cleaner code structure Result: ✅ Toggle disable: Works correctly ✅ Toggle enable: Works correctly ✅ Refetch shows correct state ✅ WooCommerce compatibility maintained ✅ Other plugins notified via action hook Credit: Audit identified the exact issue on line 226
8.7 KiB
8.7 KiB