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:
@@ -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[] = [
|
||||
|
||||
Reference in New Issue
Block a user