fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Change Thumbnail Sizing to 600px (thumbnail_image_width)

Abidin Alkilinc

Hello,

I am stuck by trying to higher the the thumbnail image width.

function sdoawesome_wc_setup()
{
add_theme_support(
‘woocommerce’,
array(
‘thumbnail_image_width’ => 600, // default 300
)
);
}
add_action(‘after_setup_theme’, ‘sdoawesome_wc_setup’);
I tried this snippet via functions.php and through a plugin. Am I missing out something?
Regards,
Abidin

Hakik Zaman

Hi Abidin,

Thanks for getting back to us.

Unfortunately, I am unable to understand your goal.

Please describe a little bit. A visual representation will help us to understand your issue.

You can upload your screenshot here- https://paste.pics/ and post the screenshot link using this reply box.

Hope to hear from you soon.

Thank You

Abidin Alkilinc

Hello,

I realize now that I might have chosen the wrong plugin to troubleshoot. The issue seems to be related to the “Additional Variation Images Gallery” plugin, which is resetting my custom image widths back to the default settings.

To clarify, my goal is to increase the width of both the thumbnail images and the single product image on the product page. Here are screenshots for reference:

Thumbnail Image: Screenshot 1 // default 300
Single Product Image: Screenshot 2 // default 600

The following code was working for me before I installed the “Additional Variation Images Gallery” plugin:

function sdoawesome_wc_setup()
{
add_theme_support(
‘woocommerce’,
array(
‘thumbnail_image_width’ => 600, // default 300
‘single_image_width’ => 900, //default 600
)
);
}
add_action(‘after_setup_theme’, ‘sdoawesome_wc_setup’);

However, after installing the “Additional Variation Images Gallery” plugin, these custom settings are getting reset to the default values, and my function stops working. I’ve tried placing the code in a plugin and hooking it at plugins_loaded with and without a priority of 99999, but I still can’t override the plugin’s settings.

I hope this explanation helps clarify the situation.

Best regards,
Abidin

Hakik Zaman

Hi Abidin,

Try the following snippets:

Single Image:

add_filter( 'woocommerce_get_image_size_single', function( $size ) {
return array(
'width' => 900, // Add your desired width value in pixel
'height' => 900, // Add your desired height value in pixel
'crop' => 0,
);
} );

Thumbnail:

add_filter( 'woocommerce_get_image_size_gallery_thumbnail', function( $size ) {
return array(
'width' => 600, // Add your desired width value in pixel
'height' => 600, // Add your desired height value in pixel
'crop' => 0,
);
} );

Thank You