I need to remove all additional images from +/- specific 600 products. From what I know and have read, it's not possible to do this through the standard CSV import feature.

Is there any trick to do this in Magento 2, without having to remove the products and re-import?

1 Answer 1


I would do it like this:

  1. export a list of all gallery images which are not set as (image, small_image, thumbnail or swatch_image) - you can extract this at db level;
  2. perform a delete action on those entries in the database media gallery table(s);
  3. create a php script which would remove (unlink) the files from the disk.
  • Had to dig a little into the database structure, but I managed to figure out. Thanks a lot Diana!
    – Jason
    Commented May 20, 2021 at 15:04
  • you are most welcome!
    – Diana
    Commented May 20, 2021 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.