fix: Improve shipping toggle and simplify UI
Fixed toggle functionality and cleaned up redundant buttons. Backend Fix: ✅ Fixed toggle to properly update shipping method settings ✅ Get existing settings, update enabled field, save back ✅ Previously was trying to save wrong data structure Frontend Changes: ✅ Removed "View in WooCommerce" from header (redundant) ✅ Changed "Edit zone" to "Settings" button (prepares for modal) ✅ Changed "+ Add shipping zone" to "Manage Zones in WooCommerce" ✅ Added modal state (selectedZone, isModalOpen) ✅ Added Dialog/Drawer imports for future modal implementation Button Strategy: - Header: Refresh only - Zone card: Settings button (will open modal) - Bottom: "Manage Zones in WooCommerce" (for add/edit/delete zones) Next Step: Implement settings modal similar to Payments page with zone/method configuration
This commit is contained in:
@@ -210,8 +210,9 @@ class ShippingController extends WP_REST_Controller {
|
||||
$method_found = true;
|
||||
|
||||
// Update the enabled status
|
||||
$method->enabled = $enabled ? 'yes' : 'no';
|
||||
update_option( $method->get_instance_option_key(), $method->instance_settings );
|
||||
$settings = get_option( $method->get_instance_option_key(), array() );
|
||||
$settings['enabled'] = $enabled ? 'yes' : 'no';
|
||||
update_option( $method->get_instance_option_key(), $settings );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user