Hi for solve this probleme u need to follow these steps :
1) From your Shopify admin, go to Online Store > Themes.
2) Find the theme you want to edit, click the … button to open the actions menu, then click Edit code.
3) Open the theme.js or theme.js.liquid file in your Assets folder.
4) At the end of the file, paste the following code:
const selectVariantByClickingImage = {
_createVariantImage : function ( product ) {
const variantImageObject = {};
product.variants.forEach((variant) => {
if (typeof variant.featured_image !== ‘undefined’ && variant.featured_image !== null) {
const variantImage = variant.featured_image.src.split(‘?’).replace(/http(s)?:/, ‘’);
variantImageObject[variantImage] = variantImageObject[variantImage] || {};
product.options.forEach((option, index) => {
const optionValue = variant.options[index];
const optionKey = option-${index};
if (typeof variantImageObject[variantImage][optionKey] === ‘undefined’) {
variantImageObject[variantImage][optionKey] = optionValue;
} else {
const oldValue = variantImageObject[