WC_Product] * * @package XShop */ declare(strict_types=1); defined('ABSPATH') || exit; $product = $args['product'] ?? null; if (is_int($product)) { $product = wc_get_product($product); } if (!$product instanceof WC_Product) { global $product; } if (!$product instanceof WC_Product) { return; } $pid = $product->get_id(); $mainId = $product->get_image_id(); $galleryIds = $product->get_gallery_image_ids(); $allIds = $mainId ? array_merge([$mainId], $galleryIds) : $galleryIds; if (empty($allIds)) { echo ''; return; } $firstUrl = wp_get_attachment_image_url($allIds[0], 'large'); ?>