2 Commits

Author SHA1 Message Date
dwindown
c1f09041ef docs: Shipping field hooks + Tax selling locations strategy
##  Issue #1: Shipping Fields - Addon Responsibility

Created SHIPPING_FIELD_HOOKS.md documenting:

**The Right Approach:**
-  NO hardcoding (if country === ID → show subdistrict)
-  YES listen to WooCommerce hooks
-  Addons declare their own field requirements

**How It Works:**
1. Addon adds field via `woocommerce_checkout_fields` filter
2. WooNooW fetches fields via API: `GET /checkout/fields`
3. Frontend renders fields dynamically
4. Validation based on `required` flag

**Benefits:**
- Addon responsibility (not WooNooW)
- No hardcoding assumptions
- Works with ANY addon (Indonesian, UPS, custom)
- Future-proof and extensible

**Example:**
```php
// Indonesian Shipping Addon
add_filter('woocommerce_checkout_fields', function($fields) {
    $fields['shipping']['shipping_subdistrict'] = [
        'required' => true,
        // ...
    ];
    return $fields;
});
```

WooNooW automatically renders it!

##  Issue #2: Tax - Grab Selling Locations

Updated TAX_SETTINGS_DESIGN.md:

**Your Brilliant Idea:**
- Read WooCommerce "Selling location(s)" setting
- Show predefined tax rates for those countries
- No re-selecting!

**Scenarios:**
1. **Specific countries** (ID, MY) → Show both rates
2. **All countries** → Show store country + add button
3. **Continent** (Asia) → Suggest all Asian country rates

**Smart Detection:**
```php
$selling_locations = get_option('woocommerce_allowed_countries');
if ($selling_locations === 'specific') {
    $countries = get_option('woocommerce_specific_allowed_countries');
    // Show predefined rates for these countries
}
```

**Benefits:**
- Zero re-selection (data already in WooCommerce)
- Smart suggestions based on user's actual selling regions
- Scales for single/multi-country/continent
- Combines your idea + my proposal perfectly!

## Next: Implementation Plan Ready
2025-11-10 11:40:49 +07:00
dwindown
8bebd3abe5 docs: Flag emoji strategy + Tax design + Shipping types
##  Issue #1: Flag Emoji Strategy (Research-Based)

Your comprehensive research revealed:
- Chrome on Windows does NOT render flag emojis
- Flags work for country selection (expected UX)
- Flags problematic for summary cards (political sensitivity)

**Action Taken:**
-  Removed flag from Store summary card
-  Changed to: "📍 Store Location: Indonesia"
-  Kept flags in dropdowns (country, currency)
-  Professional, accessible, future-proof

**Pattern:**
- Dropdowns: 🇮🇩 Indonesia (visual aid)
- Summary: 📍 Indonesia (neutral, professional)
- Shipping zones: Text only (clean, scalable)

##  Issue #2: Tax Settings Design

Created TAX_SETTINGS_DESIGN.md with:
- Toggle at top to enable/disable
- **Predefined rates based on store country**
- Indonesia: 11% (PPN) auto-shown
- Malaysia: 6% (SST) auto-shown
- Smart! No re-selecting country
- Zero learning curve

**User Flow:**
1. Enable tax toggle
2. See: "🇮🇩 Indonesia: 11% (Standard)"
3. Done! Tax working.

**For multi-country:**
1. Click "+ Add Tax Rate"
2. Select Malaysia
3. Auto-fills: 6%
4. Save. Done!

##  Issue #3: Shipping Method Types

Created SHIPPING_METHOD_TYPES.md documenting:

**Type 1: Static Methods** (WC Core)
- Free Shipping, Flat Rate, Local Pickup
- No API, immediate availability
- Basic address fields

**Type 2: Live Rate Methods** (API-based)
- UPS, FedEx, DHL (International)
- J&T, JNE, SiCepat (Indonesian)
- Requires "Calculate" button
- Returns service options

**Address Requirements:**
- International: Postal Code (required)
- Indonesian: Subdistrict (required)
- Static: Basic address only

**The Pattern:**
```
Static → Immediate display
Live Rate → Calculate → Service options → Select
```

**Next:** Fix Create Order to show conditional fields

## Documentation Added:
- TAX_SETTINGS_DESIGN.md
- SHIPPING_METHOD_TYPES.md

Both ready for implementation!
2025-11-10 11:23:42 +07:00