debug: Add comprehensive logging for toggle issue
Added debug logging to identify where enabled status is lost. Backend Logging: - Log what instance_settings["enabled"] value is read from DB - Log the computed is_enabled boolean - Log for both regular zones and Rest of World zone Frontend Logging: - Log all fetched zones data - Log each method's enabled status - Console output for easy debugging This will show us: 1. What WooCommerce stores in DB 2. What backend reads from DB 3. What backend returns to frontend 4. What frontend receives 5. What frontend displays Next: Check console + error logs to find the disconnect
This commit is contained in:
@@ -102,6 +102,16 @@ class ShippingController extends WP_REST_Controller {
|
||||
$method->init_instance_settings();
|
||||
$is_enabled = isset( $method->instance_settings['enabled'] ) && $method->instance_settings['enabled'] === 'yes';
|
||||
|
||||
// Debug: Log what we're reading
|
||||
error_log( sprintf(
|
||||
'[WooNooW] Zone %d Method %s (instance %d): enabled setting = "%s", is_enabled = %s',
|
||||
$zone_data['id'],
|
||||
$method->id,
|
||||
$method->instance_id,
|
||||
isset( $method->instance_settings['enabled'] ) ? $method->instance_settings['enabled'] : 'NOT SET',
|
||||
$is_enabled ? 'true' : 'false'
|
||||
) );
|
||||
|
||||
$rate = array(
|
||||
'id' => $method->id . ':' . $method->instance_id,
|
||||
'instance_id' => $method->instance_id,
|
||||
@@ -146,6 +156,15 @@ class ShippingController extends WP_REST_Controller {
|
||||
$method->init_instance_settings();
|
||||
$is_enabled = isset( $method->instance_settings['enabled'] ) && $method->instance_settings['enabled'] === 'yes';
|
||||
|
||||
// Debug: Log what we're reading
|
||||
error_log( sprintf(
|
||||
'[WooNooW] Zone 0 (Rest of World) Method %s (instance %d): enabled setting = "%s", is_enabled = %s',
|
||||
$method->id,
|
||||
$method->instance_id,
|
||||
isset( $method->instance_settings['enabled'] ) ? $method->instance_settings['enabled'] : 'NOT SET',
|
||||
$is_enabled ? 'true' : 'false'
|
||||
) );
|
||||
|
||||
$rate = array(
|
||||
'id' => $method->id . ':' . $method->instance_id,
|
||||
'instance_id' => $method->instance_id,
|
||||
|
||||
Reference in New Issue
Block a user