Commit Graph

2 Commits

Author SHA1 Message Date
dwindown
64e6fa6da0 docs: Align METABOX_COMPAT with 3-level compatibility strategy
**Clarification: Level 1 Compatibility**

Following ADDON_BRIDGE_PATTERN.md philosophy:

**3-Level Compatibility Strategy:**

Level 1: Native WP/WooCommerce Hooks 🟢 (THIS IMPLEMENTATION)
- Community does NOTHING extra
- Plugins use standard add_meta_box(), update_post_meta()
- WooNooW listens and exposes data automatically
- Status:  NOT IMPLEMENTED - MUST DO NOW

Level 2: Bridge Snippets 🟡 (Already documented)
- For non-standard behavior (e.g., Rajaongkir custom UI)
- Community creates simple bridge
- WooNooW provides hook system + docs
- Status:  Hook system exists

Level 3: Native WooNooW Addons 🔵 (Already documented)
- Best experience, native integration
- Community builds proper addons
- Status:  Addon system exists

**Key Principle:**
We are NOT asking community to create WooNooW-specific addons.
We are asking them to use standard WooCommerce hooks.
We LISTEN and INTEGRATE automatically.

**Example (Level 1):**
Plugin stores: update_post_meta($order_id, '_tracking_number', $value)
WooNooW: Exposes via API automatically
Result: Plugin works WITHOUT any extra effort

**Updated METABOX_COMPAT.md:**
- Added 3-level strategy overview
- Clarified Level 1 is about listening to standard hooks
- Emphasized community does NOTHING extra
- Aligned with ADDON_BRIDGE_PATTERN.md philosophy

**Confirmation:**
 Yes, we MUST implement Level 1 now
 This is about listening to WooCommerce bone
 Not about special integration
 Community uses standard hooks, we listen
2025-11-20 11:37:27 +07:00
dwindown
f7dca7bc28 docs: Critical metabox & custom fields compatibility gap identified
**Issue: Third-Party Plugin Compatibility**

Current Status:  NOT IMPLEMENTED
Priority: 🔴 CRITICAL - Blocks production readiness

**Problem:**
Our SPA admin does NOT expose:
- Custom meta fields from third-party plugins
- WordPress metaboxes (add_meta_box)
- WooCommerce custom fields
- ACF/CMB2/Pods fields
- Plugin-injected data (e.g., Tracking Number)

**Example Use Case:**
Plugin: WooCommerce Shipment Tracking
- Adds 'Tracking Number' metabox to order edit page
- Stores: _tracking_number meta field
- Current:  NOT visible in WooNooW admin
- Expected:  Should be visible and editable

**Impact:**
1. Breaks compatibility with popular plugins
2. Users cannot see/edit custom fields
3. Data exists but not accessible in SPA
4. Forces users back to classic admin
5. BLOCKS production readiness

**Solution Architecture:**

Phase 1: API Layer (2-3 days)
- Expose meta_data in OrdersController::show()
- Expose meta_data in ProductsController::get_product()
- Add filters: woonoow/order_api_data, woonoow/product_api_data
- Add filters: woonoow/order_allowed_private_meta
- Add actions: woonoow/order_updated, woonoow/product_updated

Phase 2: Frontend Components (3-4 days)
- Create MetaFields.tsx component
- Create useMetaFields.ts hook
- Update Orders/Edit.tsx to include meta fields
- Update Products/Edit.tsx to include meta fields
- Add meta fields to detail pages

Phase 3: Plugin Integration (2-3 days)
- Create MetaFieldsRegistry.php
- Add woonoow/register_meta_fields action
- Localize fields to JavaScript
- Create example: ShipmentTracking.php integration
- Document integration pattern

**Documentation Created:**
- METABOX_COMPAT.md - Complete implementation guide
- Includes code examples for all phases
- Includes third-party integration guide
- Includes testing checklist

**Updated:**
- PROJECT_SOP.md - Added metabox compat reference
- Marked as CRITICAL requirement
- Noted as blocking production readiness

**Timeline:**
Total: 1-2 weeks implementation

**Blocking:**
-  Coupons CRUD (can proceed)
-  Customers CRUD (can proceed)
-  Production readiness (BLOCKED)

**Next Steps:**
1. Review METABOX_COMPAT.md
2. Prioritize implementation
3. Start with Phase 1 (API layer)
4. Test with popular plugins (Shipment Tracking, ACF)
2025-11-20 11:11:06 +07:00