Invoice: - Enhanced A4-ready layout with proper structure - Store header with invoice number - Billing/shipping address sections - Styled items table with alternating rows - Totals summary with conditional display - Thank you footer Label: - Label button now hidden for virtual-only orders - Uses existing isVirtualOnly detection Print CSS: - Added @page A4 size directive - Print-color-adjust for background colors - 20mm padding for proper margins Documentation: - Updated subscription module plan (comprehensive) - Updated affiliate module plan (comprehensive) - Created shipping label standardization plan
2.1 KiB
2.1 KiB
Shipping Label Plan
Overview
Standardized waybill data structure for shipping label generation.
Problem
- Different shipping carrier addons (JNE, JNT, SiCepat, etc.) store data differently
- No standard structure for label generation
- Label button needs waybill data to function
Proposed Solution
1. Standardized Meta Key
Order meta: _shipping_waybill
2. Data Structure
{
"tracking_number": "JNE123456789",
"carrier": "jne",
"carrier_name": "JNE Express",
"service": "REG",
"estimated_days": 3,
"sender": {
"name": "Store Name",
"address": "Full address line 1",
"city": "Jakarta",
"postcode": "12345",
"phone": "08123456789"
},
"recipient": {
"name": "Customer Name",
"address": "Full address line 1",
"city": "Bandung",
"postcode": "40123",
"phone": "08987654321"
},
"package": {
"weight": "1.5",
"weight_unit": "kg",
"dimensions": "20x15x10",
"dimensions_unit": "cm"
},
"label_url": null,
"barcode": "JNE123456789",
"barcode_type": "128",
"created_at": "2026-01-05T12:00:00+07:00"
}
3. Addon Integration Contract
Shipping addons MUST:
- Call
update_post_meta($order_id, '_shipping_waybill', $waybill_data) - Use the standard structure above
- Set
label_urlif carrier provides downloadable PDF - Set
barcodefor local label generation
4. Label Button Behavior
- Check if
_shipping_waybillmeta exists on order - If
label_url→ open carrier's PDF - Otherwise → generate printable label from meta data
5. UI Behavior
- Label button hidden if order is virtual-only
- Label button shows "Generate Label" if no waybill yet
- Label button shows "Print Label" if waybill exists
API Endpoint (Future)
POST /woonoow/v1/orders/{id}/generate-waybill
- Calls shipping carrier API
- Stores waybill in standardized format
- Returns waybill data
GET /woonoow/v1/orders/{id}/waybill
- Returns current waybill data
Implementation Priority
- Define standard structure (this document)
- Implement Label UI conditional logic
- Create waybill API endpoint
- Document for addon developers