Rating 5 stars - 1 votes

How to mass exclude/ unexclude images from gallery in Magento 2

When adding images to Magento products, the pictures are placed to the gallery - you can all them displayed in the 'More Views' lightbox under a main image. There are included images marked as base, small and thumbnail and other additional pictures you added. They are visible at product page, unless you've checked 'Exclude' option.

Image gallery Magento
Magento Mass Exclude Images

Why to Exclude Images from Magento 2 Gallery?

Imagine the situation - you have added a few images to item and marked 3 of them as small, base and thumbnail. Normally base image is already shown as main picture there, so often people do not want this image appear twice on product detail page.

You might also have different images if product comes in various colours. When some of color variation becomes out of stock you may need to exclude its picture from the gallery as well.

The reasons to exclude images might be numerous, though when you need to do this for bulks of goods it can be really time-consuming and tiring talk.

How to Check/ Uncheck Exclude Images Option Massively via Import?

To automate this process you can run a query if you have enough tech skills. If this is not the case, you can use Store Manager application

Try Store Manager for Magento to mass exclude/unexclude images!Download FREE

Here are a few simple steps to follow:

    1. Export

    Run Import / Export Wizard of Store Manager for Magento and select what fields you want to be exported to CSV. Basically you need only the following fields:

    • SKU
    • Media Gallery
    • Media Gallery Exclude

    Run Export Wizard of Store Manager
    Magento Mass Exclude Images

    There is no need to export all the fields, since Store Manager allows you to select what exactly info you need to be exported. At the step ‘Select Fields to Export’ on the left you see available fields with data. Drag necessary ones from the left and drop to the right pane of the window. You can also use buttons in the middle to add fields to be included in CSV.

    2. Edit File

    (optional if you are using expressions)

    Open the file in any spreadsheet editor like OpenOffice.

    In the 'Media Gallery Exclude' column you will find the following numbers:

  1. 1 means that 'Exclude' box is checked for the appropriate image (you can check what exactly in column Media Gallery containing images);
  2. 0 indicates that image is not excluded from gallery and visible at clients' side.

  3. Open the exported file and exclude the needed images
    Magento Mass Exclude Images

    If you want to exclude images - put 1, to make images unexcluded - 0.

    Want to automate the process and skip this step as you have got a multitude of images and goods? Keep reading and you will find out how to use expressions during import for on-the-fly changes.

    3. Import to Magento

    In case your import file contains necessary modifications mentioned in point 2, you can simply run Import Wizard of Store Manager for Magento upload file to apply changes.

    You can find a step-by-step Magento import tutorial read here -


    Important images settings during import:

    If you are updating existing images, in additional settings you need to tick the ‘Import Images' and ‘Clear Image Gallery’ options.

    Important images settings during import
    Magento Mass Exclude Images

    If you want to speed up the process and avoid manual work with file, with Store Manager for Magento you can use special expressions (SQL statement and calculations similar to ones that are used in Excel).

    Expressions during import can be set at the step where you map CSV columns to database fields.

    Un-assign column ‘Media Gallery Exclude’
    Magento Mass Exclude Images

    If you use exported file and didn't change heading names, your columns were mapped automatically. If yes, un-assign column ‘Media Gallery Exclude’.

    To uncheck Exclude box for all the images and all the product SKUs in file, in tab Expression put the following formula:

    REPLACE ([CSV_COL(x)],1,0)

    Instead X put number of column where in your file you have data from images to be excluded (in our case it is number 3).

    Uncheck Exclude box for all the images by entering the formula in Tab expression
    Magento Mass Exclude Images

    To check Exclude option massively for all the images assigned to products in file, use this expression:

    REPLACE ([CSV_COL(x)],0,1)

    Again instead of X you need to put column name as in example above. This will replace all zeros with 1 and this way check Exclude box.

    Please note: this expression will implement changes to all the images belonging to products you have in file.

    If you need more complex modifications to be performed during import with the help of expressions contact our support via contact@mag-manager.com

    Mass check or uncheck Exclude button for your images without coding!Download FREE

    Related Articles:

    batch remove magento images tutorial

    Batch Remove Magento Images

    Find out how to delete all images for particular goods and remove the unused Magento images from our server. Read More...

    detect missing duplicated unlinked magento images

    No More Missing, Duplicated or Unlinked Magento Images

    Find out how to prevent your images from getting duplicated, unlinked or undisplayed and what to do if issue occured. Read More...

    change sort order of your magento images using import

    Change Sort Order of Your Magento Images Using Import

    Tutorial on how to properly prepare your import CSV to change Magetno images sort order. Read More...

    upload magento swatch images to configurable products

    Upload Magento Swatch Images to Configurable Products

    Get the full explanation of Magento swatch images and their purpuses and find out the ways to assign them to products via admin and Store Manager. Read More...

    Be the first to comment.
Live Chat