fix: Product form TypeScript and API errors

Fixed Issues:
1. TypeScript error on .indeterminate property (line 332)
   - Cast checkbox element to any for indeterminate access
2. API error handling for categories/tags endpoints
   - Added is_wp_error() checks
   - Return empty array on error instead of 500

Next: Implement modern tabbed product form (Shopify-style)
This commit is contained in:
dwindown
2025-11-19 22:00:15 +07:00
parent 5126b2ca64
commit 89b31fc9c3
2 changed files with 13 additions and 1 deletions

View File

@@ -347,6 +347,10 @@ class ProductsController {
'hide_empty' => false,
]);
if (is_wp_error($terms)) {
return new WP_REST_Response([], 200); // Return empty array on error
}
$categories = [];
foreach ($terms as $term) {
$categories[] = [
@@ -370,6 +374,10 @@ class ProductsController {
'hide_empty' => false,
]);
if (is_wp_error($terms)) {
return new WP_REST_Response([], 200); // Return empty array on error
}
$tags = [];
foreach ($terms as $term) {
$tags[] = [