feat: Multiple fixes and features

1. Add allow_custom_avatar toggle to Customer Settings
2. Implement coupon apply/remove in Cart and Checkout pages
3. Update Cart interface with coupons array and discount_total
4. Implement Downloads page to fetch from /account/downloads API
This commit is contained in:
Dwindi Ramadhana
2026-01-04 20:03:33 +07:00
parent befacf9d29
commit 0f542ad452
13 changed files with 420 additions and 32 deletions

View File

@@ -13,6 +13,7 @@ import { formatMoney, getStoreCurrency } from '@/lib/currency';
interface CustomerSettings {
auto_register_members: boolean;
multiple_addresses_enabled: boolean;
allow_custom_avatar: boolean;
vip_min_spent: number;
vip_min_orders: number;
vip_timeframe: 'all' | '30' | '90' | '365';
@@ -24,6 +25,7 @@ export default function CustomersSettings() {
const [settings, setSettings] = useState<CustomerSettings>({
auto_register_members: false,
multiple_addresses_enabled: true,
allow_custom_avatar: false,
vip_min_spent: 1000,
vip_min_orders: 10,
vip_timeframe: 'all',
@@ -138,6 +140,14 @@ export default function CustomersSettings() {
onCheckedChange={(checked) => setSettings({ ...settings, multiple_addresses_enabled: checked })}
/>
<ToggleField
id="allow_custom_avatar"
label={__('Allow custom profile photo')}
description={__('Allow customers to upload their own profile photo. When disabled, customer avatars will use Gravatar or default initials.')}
checked={settings.allow_custom_avatar}
onCheckedChange={(checked) => setSettings({ ...settings, allow_custom_avatar: checked })}
/>
</div>
</SettingsCard>