fix: Add tagline to Login branding state + troubleshooting doc

This commit is contained in:
dwindown
2025-11-11 10:14:09 +07:00
parent 432d84992c
commit 677c04dd62
2 changed files with 133 additions and 0 deletions

View 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

View File

@@ -16,6 +16,7 @@ export function Login() {
logo: '',
logoDark: '',
storeName: 'WooNooW',
tagline: '',
});
const [isDark, setIsDark] = React.useState(false);
const navigate = useNavigate();
@@ -46,6 +47,7 @@ export function Login() {
logo: data.store_logo || '',
logoDark: data.store_logo_dark || '',
storeName: data.store_name || 'WooNooW',
tagline: data.store_tagline || '',
});
})
.catch(err => console.error('Failed to load branding:', err));