When I try to fetch products using the official REST API, returned product
contains the a property named images
which is an array and contains the URL to image of product.
But when I fetch using this method, it fetches other details but not the image.
$productsQuery= wc_get_products(array(
'limit' => 10,
'status' => 'publish',
));
$products = array();
foreach ($productsQuery as $product) {
$products[] = $product->get_data();
}
return new WP_REST_Response($products, 200);
how can I make this to return the images
property as well.