fix: multiple checkout and settings fixes
1. Remove wishlist setting from customer settings (now in module toggle) - Removed from CustomerSettingsProvider.php - Removed from Customers.tsx 2. Remove auto-login from REST API (causes cookie issues) - Auto-login in REST context doesn't properly set browser cookies - Removed wp_set_current_user/wp_set_auth_cookie calls 3. Fix cart not clearing after order - Added WC()->cart->empty_cart() after successful order - Server-side cart was not being cleared, causing re-population - Frontend clears local store but Cart page syncs with server
This commit is contained in:
@@ -313,10 +313,6 @@ class CheckoutController {
|
||||
|
||||
// Send new account email (WooCommerce will handle this automatically via hook)
|
||||
do_action('woocommerce_created_customer', $new_user_id, $userdata, $password);
|
||||
|
||||
// Auto-login the newly registered user for smoother UX
|
||||
wp_set_current_user($new_user_id);
|
||||
wp_set_auth_cookie($new_user_id, true); // true = remember me
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -398,6 +394,12 @@ class CheckoutController {
|
||||
header('Server-Timing: app;dur=' . round((microtime(true) - $__t0) * 1000, 1));
|
||||
}
|
||||
|
||||
// Clear WooCommerce cart after successful order placement
|
||||
// This ensures the cart page won't re-populate from server session
|
||||
if (function_exists('WC') && WC()->cart) {
|
||||
WC()->cart->empty_cart();
|
||||
}
|
||||
|
||||
return [
|
||||
'ok' => true,
|
||||
'order_id' => $order->get_id(),
|
||||
|
||||
@@ -21,7 +21,6 @@ class CustomerSettingsProvider {
|
||||
// General
|
||||
'auto_register_members' => get_option('woonoow_auto_register_members', 'no') === 'yes',
|
||||
'multiple_addresses_enabled' => get_option('woonoow_multiple_addresses_enabled', 'yes') === 'yes',
|
||||
'wishlist_enabled' => get_option('woonoow_wishlist_enabled', 'yes') === 'yes',
|
||||
|
||||
// VIP Customer Qualification
|
||||
'vip_min_spent' => floatval(get_option('woonoow_vip_min_spent', 1000)),
|
||||
@@ -50,10 +49,7 @@ class CustomerSettingsProvider {
|
||||
update_option('woonoow_multiple_addresses_enabled', $value);
|
||||
}
|
||||
|
||||
if (array_key_exists('wishlist_enabled', $settings)) {
|
||||
$value = !empty($settings['wishlist_enabled']) ? 'yes' : 'no';
|
||||
update_option('woonoow_wishlist_enabled', $value);
|
||||
}
|
||||
|
||||
|
||||
// VIP settings
|
||||
if (isset($settings['vip_min_spent'])) {
|
||||
|
||||
Reference in New Issue
Block a user