Solved: The image cannot be removed as it has been assigned to the other image role in Magento2





The image cannot be removed as it has been assigned to the other image role
Solved: The image cannot be removed as it has been assigned to the other image role in Magento2




I have been using Magento2 for quite a few months now and it’s always good to learn new things and share my experience with other developers.

I recently tried to remove an image from a configurable product and I received an error telling me that ‘The image cannot be removed as it has been assigned to the other image role’, it was an odd message because I was sure that I unset that image and set a new image as base, small and thumbnail, however, something wasn’t still right so I did the following to fix this:




  • Make sure that you are not in the DEFAULT STORE view, if that is the case, please switch to your website store view.
  • Set another image as Base, thumbnail and small image.
  • Now you can easily remove the image.

Please share this post with others if the solution worked for you.

Solved: Magento 2 mini cart does not update and show the added products





Hi everyone,

After using Magento 1 for a few years, I decided to upgrade one of my clients website to Magento 2 however, it was not an easy task to do as the overall architecture and code base has changed in M2. To be honest, I must say that Magento 2 is much easier to code compared to M1 but it will take a while to understand the structure and code base, and trust me you will face quite a few bugs and errors in the system.

Recently I noticed that on my client’s website, the mini cart stopped working and did not show any products in the popup. As a developer, I knew that the products were added in the system and I tested it by going directly to the checkout page: http://mywebsite.xyz/checkout/cart; so what I did was the following:




  1. Checked System.log and exception.log files
  2. Checked browser’s Developer’s network tabs to read the request/response
  3. Made sure that Magento was up to date because this issue was raised in Magento 2.0 and then Magento fixed it in Magento 2.1

You can check all Magento2 articles here.




After upgrading Magento, the issue was still there so I did the very basic thing; I made sure that caching was disabled and then enabled it. After I enabled the cache, I realised that some of the blocks were invalidated so I flushed the cache storage and tested everything on the frontend again. Everything was normal and read to deploy to the production website.

Index Magento 2 using command line or SSH

Magento 2 is the latest hot topic in the ecommerce market and given their new architecture, it’s very easy to configure it using command line or SSH.

Follow these steps to reindex Magento 2 using the command line:



  1. Login to SSH/Command line
  2. Go to your Magento root directory
  3. Once in root, type cd bin
  4. In Bin, to reindex all configurations type magento indexer:reindex and hit enter. Magento 2 will start reindexing the system. Screenshot below:

    magento-2-reindex-ssh
    Re-index Magento 2 using command line

That’s all. You have just reindexed your magento store in one go.
Note: If you get ‘magento: command not found’, then use php keyword to run the indexing. 




Other commands to index individual sections: 

magento indexer:reindex customer_grid Customer
magento indexer:reindex catalog_category_product
magento indexer:reindex catalog_product_category
magento indexer:reindex catalog_product_price
magento indexer:reindex catalog_product_attribute
magento indexer:reindex cataloginventory_stock
magento indexer:reindex catalogsearch_fulltext
magento indexer:reindex catalogrule_rule
magento indexer:reindex catalogrule_product