Automattic\WooCommerce\Blocks\Utils

ProductGalleryUtils::get_product_gallery_image_items │ private static │ WC 1.0

Get the product gallery image items.

Method of the class: ProductGalleryUtils{}

No Hooks.

Returns

array[]. An array of image media items for the product gallery.

Usage

$result = ProductGalleryUtils::get_product_gallery_image_items( $product );
$product(WC_Product) (required)
The product object to retrieve the gallery images for.

ProductGalleryUtils::get_product_gallery_image_items() code WC 11.1.2

private static function get_product_gallery_image_items( $product ) {
	return array_map(
		static function ( $image_id ) {
			return array(
				'media_type'  => 'image',
				'source_type' => 'attachment',
				'id'          => absint( $image_id ),
			);
		},
		self::get_product_gallery_image_ids( $product )
	);
}