Woocommerce: Permanently delete images when a product is deleted

woocommerce delete images permanently

When you delete a product, normally images are left in the media gallery. You may wonder how to permanently delete all the images of the product. This code snippet will help you to automatically delete the images the moment a product is deleted.