Add Filter for rest api in set_product_images

woocommerce\includes\api\class-wc-rest-products-controller.php
on line 235
woocommerce\includes\api\v2\class-wc-rest-products-v2-controller.php
on line 1088
woocommerce\includes\api\v1\class-wc-rest-products-controller.php
on line 851$attachment_id = apply_filters( 'woocommerce_rest_check_product_image_attachment_exist', $attachment_id, $image );

This filter will be use to check, if product attachment is exist or not.
if it exist it will assign the id of that attachment. it will minimize the download the image attachment request and other download process.
hope you understand.

it sounds like you’re looking for a filter to be added to the core WooCommerce plugin – right?

If that is indeed correct, please open a Github issue for our developers to consider over at https://github.com/woocommerce/woocommerce/issues. Alternatively, if you want, you can also submit a Pull Request to have your request/code merged (and thereby become a core contributor! )