feat(checkout): dynamic checkout fields with PHP filter support
Backend (CheckoutController): - Enhanced get_fields() API with custom_attributes, search_endpoint, search_param, min_chars, input_class, default - Supports new 'searchable_select' field type for API-backed search Customer SPA: - Created DynamicCheckoutField component for all field types - Checkout fetches fields from /checkout/fields API - Renders custom fields from PHP filters (billing + shipping) - searchable_select type with live API search - Custom field data included in checkout submission This enables: - Checkout Field Editor Pro compatibility - Rajaongkir destination_id via simple code snippet - Any plugin using woocommerce_checkout_fields filter Updated RAJAONGKIR_INTEGRATION.md with code snippet approach.
This commit is contained in:
@@ -475,6 +475,14 @@ class CheckoutController {
|
||||
'custom' => !in_array($key, $this->get_standard_field_keys()), // Flag custom fields
|
||||
'autocomplete'=> $field['autocomplete'] ?? '',
|
||||
'validate' => $field['validate'] ?? [],
|
||||
// New fields for dynamic rendering
|
||||
'input_class' => $field['input_class'] ?? [],
|
||||
'custom_attributes' => $field['custom_attributes'] ?? [],
|
||||
'default' => $field['default'] ?? '',
|
||||
// For searchable_select type
|
||||
'search_endpoint' => $field['search_endpoint'] ?? null,
|
||||
'search_param' => $field['search_param'] ?? 'search',
|
||||
'min_chars' => $field['min_chars'] ?? 2,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user