, , () .
To add a sketch, use this:
$product_id = '652';
$product = new WC_product($product_id);
$attachment_ids = $product->get_gallery_image_ids();
// This adds the thumbnail id as the first element of the array
array_unshift($attachment_ids, get_post_thumbnail_id($product_id));
print_r($attachment_ids);
source
share