I use configurable products with several color swatches to choose from.
Most swatches behaves well but when certain colors are selected the main product image does not change, i.e previously selected simple product image stays.
I verified that problematic can be added to the cart with expected images. The problem occurs on the configurable product page only and always for the same swatches.
It sounds like you are experiencing an issue where the main product image is not changing when certain swatches are selected on your configurable product page. This could be caused by a few different things. Here are a few troubleshooting steps you can try:
Check the product attributes: Make sure that the product attributes associated with the problematic swatches have been properly configured with the correct images. You can do this by going to Catalog > Attributes > Manage Attributes and checking the "Image" and "Thumbnail" fields for the problematic attributes.
Check the associated simple products: Make sure that the associated simple products for the problematic swatches have been properly configured with the correct images. You can do this by going to Catalog > Manage Products, selecting the problematic configurable product, and then selecting the "Associated Products" tab. Check the "Base Image", "Small Image", and "Thumbnail" fields for each associated simple product.
Check for conflicts with third-party extensions: Sometimes third-party extensions can cause conflicts with the product image functionality in Magento. Try disabling any recently installed extensions to see if that resolves the issue.
Check your theme's JavaScript files: The product image functionality on the configurable product page relies on JavaScript. Make sure that your theme's JavaScript files are not causing conflicts with the product image functionality. You can try disabling your theme's JavaScript files to see if that resolves the issue.
Check your server logs: Check your server logs to see if there are any errors or warnings related to the product image functionality. This may give you a clue as to what is causing the issue.
If none of these steps resolve the issue, you may need to enlist the help of a Magento developer to further troubleshoot the issue. They will be able to review your server logs and database to determine the root cause of the problem and recommend a solution.