fix: Add tagline to Login branding state + troubleshooting doc
This commit is contained in:
131
CUSTOMER_SETTINGS_404_FIX.md
Normal file
131
CUSTOMER_SETTINGS_404_FIX.md
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
# Customer Settings 404 Error - Troubleshooting Guide
|
||||||
|
|
||||||
|
## Issue
|
||||||
|
The `/store/customer-settings` endpoint returns 404 error.
|
||||||
|
|
||||||
|
## Verification Steps
|
||||||
|
|
||||||
|
### 1. Check if routes are registered
|
||||||
|
The routes ARE correctly registered in `includes/Api/StoreController.php`:
|
||||||
|
- Line 90-97: GET `/woonoow/v1/store/customer-settings`
|
||||||
|
- Line 99-106: POST `/woonoow/v1/store/customer-settings`
|
||||||
|
|
||||||
|
### 2. Check if controller is initialized
|
||||||
|
The controller IS initialized in `includes/Api/Routes.php`:
|
||||||
|
- Line 56-57: `new StoreController()` and `register_routes()`
|
||||||
|
|
||||||
|
### 3. Check if class exists
|
||||||
|
The `CustomerSettingsProvider` class EXISTS in:
|
||||||
|
- `includes/Compat/CustomerSettingsProvider.php`
|
||||||
|
- Namespace: `WooNooW\Compat`
|
||||||
|
|
||||||
|
## Possible Causes & Solutions
|
||||||
|
|
||||||
|
### Solution 1: Flush WordPress Permalinks
|
||||||
|
WordPress may need to rebuild its rewrite rules.
|
||||||
|
|
||||||
|
**Via WP-Admin:**
|
||||||
|
1. Go to Settings → Permalinks
|
||||||
|
2. Click "Save Changes" (no need to change anything)
|
||||||
|
|
||||||
|
**Via WP-CLI:**
|
||||||
|
```bash
|
||||||
|
wp rewrite flush
|
||||||
|
```
|
||||||
|
|
||||||
|
### Solution 2: Check Debug Logs
|
||||||
|
Debug logging has been added to track the issue:
|
||||||
|
|
||||||
|
**Enable WordPress Debug:**
|
||||||
|
Add to `wp-config.php`:
|
||||||
|
```php
|
||||||
|
define('WP_DEBUG', true);
|
||||||
|
define('WP_DEBUG_LOG', true);
|
||||||
|
define('WP_DEBUG_DISPLAY', false);
|
||||||
|
```
|
||||||
|
|
||||||
|
**Check logs:**
|
||||||
|
```bash
|
||||||
|
tail -f wp-content/debug.log
|
||||||
|
```
|
||||||
|
|
||||||
|
Look for:
|
||||||
|
- `WooNooW: get_customer_settings called`
|
||||||
|
- `WooNooW: Customer settings retrieved: ...`
|
||||||
|
- `WooNooW: get_customer_settings exception: ...`
|
||||||
|
|
||||||
|
### Solution 3: Test Endpoint Directly
|
||||||
|
Open browser console and run:
|
||||||
|
```javascript
|
||||||
|
fetch(window.WNW_CONFIG.restUrl + '/store/customer-settings', {
|
||||||
|
headers: {
|
||||||
|
'X-WP-Nonce': window.wpApiSettings.nonce
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(r => r.json())
|
||||||
|
.then(console.log)
|
||||||
|
.catch(console.error);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Solution 4: Verify REST API is Working
|
||||||
|
Test a known endpoint:
|
||||||
|
```javascript
|
||||||
|
fetch(window.WNW_CONFIG.restUrl + '/store/branding')
|
||||||
|
.then(r => r.json())
|
||||||
|
.then(console.log);
|
||||||
|
```
|
||||||
|
|
||||||
|
If this fails, the REST API itself may be broken.
|
||||||
|
|
||||||
|
### Solution 5: Check .htaccess
|
||||||
|
Ensure `.htaccess` has WordPress rewrite rules:
|
||||||
|
```apache
|
||||||
|
# BEGIN WordPress
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteBase /
|
||||||
|
RewriteRule ^index\.php$ - [L]
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteRule . /index.php [L]
|
||||||
|
</IfModule>
|
||||||
|
# END WordPress
|
||||||
|
```
|
||||||
|
|
||||||
|
## Expected Behavior
|
||||||
|
|
||||||
|
**GET Request:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"vip_min_spent": 1000,
|
||||||
|
"vip_min_orders": 10,
|
||||||
|
"vip_timeframe": "all",
|
||||||
|
"vip_require_both": true,
|
||||||
|
"vip_exclude_refunded": true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**POST Request:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"message": "Customer settings updated successfully",
|
||||||
|
"settings": { ... }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Quick Fix Checklist
|
||||||
|
- [ ] Flush permalinks
|
||||||
|
- [ ] Enable debug logging
|
||||||
|
- [ ] Check debug.log for errors
|
||||||
|
- [ ] Test endpoint in browser console
|
||||||
|
- [ ] Verify other REST endpoints work
|
||||||
|
- [ ] Check .htaccess file
|
||||||
|
- [ ] Clear all caches (browser, WordPress, server)
|
||||||
|
|
||||||
|
## Still Not Working?
|
||||||
|
If none of the above works, there may be:
|
||||||
|
1. Plugin conflict (disable other plugins temporarily)
|
||||||
|
2. Theme conflict (switch to default theme temporarily)
|
||||||
|
3. Server configuration issue (check with hosting provider)
|
||||||
|
4. WordPress REST API disabled by security plugin
|
||||||
@@ -16,6 +16,7 @@ export function Login() {
|
|||||||
logo: '',
|
logo: '',
|
||||||
logoDark: '',
|
logoDark: '',
|
||||||
storeName: 'WooNooW',
|
storeName: 'WooNooW',
|
||||||
|
tagline: '',
|
||||||
});
|
});
|
||||||
const [isDark, setIsDark] = React.useState(false);
|
const [isDark, setIsDark] = React.useState(false);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -46,6 +47,7 @@ export function Login() {
|
|||||||
logo: data.store_logo || '',
|
logo: data.store_logo || '',
|
||||||
logoDark: data.store_logo_dark || '',
|
logoDark: data.store_logo_dark || '',
|
||||||
storeName: data.store_name || 'WooNooW',
|
storeName: data.store_name || 'WooNooW',
|
||||||
|
tagline: data.store_tagline || '',
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(err => console.error('Failed to load branding:', err));
|
.catch(err => console.error('Failed to load branding:', err));
|
||||||
|
|||||||
Reference in New Issue
Block a user