fix: Use active WooCommerce currency instead of hardcoded USD
Fixed Issues:
1. ✅ Currency hardcoded to USD in product forms
2. ✅ Edit page redirect to non-existent detail page
Changes:
🌍 Currency Integration (GeneralTab.tsx):
- Import getStoreCurrency() from @/lib/currency
- Get store currency data: symbol, decimals, position
- Replace hardcoded $ icon with dynamic store.symbol
- Use store.decimals for input step:
* step="1" for zero-decimal currencies (IDR, JPY, etc.)
* step="0.01" for decimal currencies (USD, EUR, etc.)
- Update placeholder based on decimals:
* "0" for zero-decimal
* "0.00" for decimal
Before:
- <DollarSign /> icon (always $)
- step="0.01" (always 2 decimals)
- placeholder="0.00" (always 2 decimals)
After:
- <span>{store.symbol}</span> (Rp, $, RM, etc.)
- step={store.decimals === 0 ? '1' : '0.01'}
- placeholder={store.decimals === 0 ? '0' : '0.00'}
🌍 Currency Display (index.tsx):
- Import formatMoney() from @/lib/currency
- Replace hardcoded $:
* Before: ${parseFloat(product.regular_price).toFixed(2)}
* After: formatMoney(product.regular_price)
- Now respects:
* Currency symbol (Rp, $, RM, etc.)
* Decimal places (0 for IDR, 2 for USD)
* Thousand separator (. for IDR, , for USD)
* Decimal separator (, for IDR, . for USD)
* Position (left/right/left_space/right_space)
Examples:
- IDR: Rp 100.000 (no decimals, dot separator)
- USD: $100.00 (2 decimals, comma separator)
- MYR: RM 100.00 (2 decimals)
🔧 Edit Page Fix:
- Changed redirect after update:
* Before: navigate(`/products/${id}`) → 404 (no detail page)
* After: navigate('/products') → products list ✅
Result:
✅ Product forms use active WooCommerce currency
✅ Prices display with correct symbol and format
✅ Input fields respect currency decimals
✅ Edit page redirects to index after save
✅ Consistent with Orders module pattern