diff --git a/includes/api/class-wc-rest-products-controller.php b/includes/api/class-wc-rest-products-controller.php index fc82151a6df..beb49effc65 100644 --- a/includes/api/class-wc-rest-products-controller.php +++ b/includes/api/class-wc-rest-products-controller.php @@ -1033,7 +1033,7 @@ class WC_REST_Products_Controller extends WC_REST_Legacy_Products_Controller { * @return WC_Product */ protected function set_product_images( $product, $images ) { - if ( is_array( $images ) ) { + if ( is_array( $images ) && ! empty( $images ) ) { $gallery = array(); foreach ( $images as $image ) {