Reputation: 51
Whenever I go to WooCommerce > Settings > Products > Display, change the Image dimensions and press "Save changes" it doesn't save the changes.
I know I have to use the Regenerate Thumbnails plugin, when changes have been saved, but the issue is that the "Save changes"-button doesn't change the settings.
My theme is called Converio and the converio/functions.php contain the following code:
if (class_exists('Woocommerce')) {
include('functions/woocommerce-support.php');
}
The converio/functions/woocommerce-support.php contain the following code:
function converio_woocommerce_image_dimensions() {
$catalog = array(
'width' => '560', // px
'height' => '627', // px
'crop' => 1 // true
);
$single = array(
'width' => '560', // px
'height' => '626', // px
'crop' => 1 // true
);
$thumbnail = array(
'width' => '60', // px
'height' => '60', // px
'crop' => 1 // false
);
// Image sizes
update_option('shop_catalog_image_size', $catalog); // Product category thumbs
update_option('shop_single_image_size', $single); // Single product image
update_option('shop_thumbnail_image_size', $thumbnail); // Image gallery thumbs
}
Since I don't want to change the parent theme by removing the code, I've tried to solve the issue by myself by overwriting it in the child theme, but without luck.
I have made a converio-child-theme/functions.php and added the following code:
if (class_exists('Woocommerce')) {
include('converio-child-theme/functions/woocommerce-image-dimensions-fix.php');
}
I have then created converio-child-theme/functions/woocommerce-image-dimensions-fix.php and added the following code:
function converio_woocommerce_image_dimensions_fix() {
$catalog = array(
'width' => '560', // px
'height' => '627', // px
'crop' => 1 // true
);
$single = array(
'width' => '560', // px
'height' => '626', // px
'crop' => 1 // true
);
$thumbnail = array(
'width' => '60', // px
'height' => '60', // px
'crop' => 1 // false
);
// Image sizes
update_option('shop_catalog_image_size', '', false); // Product category thumbs
update_option('shop_single_image_size', '', false); // Single product image
update_option('shop_thumbnail_image_size', '', false); // Image gallery thumbs
}
But it doesn't fix the problem with the images going back to default, after changes is saved. Can anyone tell me, what I'm doing wrong?
Upvotes: 5
Views: 1989
Reputation: 107
you have to regenerate all thumbnails again otherwise add new products after save changes on WooCommerce > Settings > Products > Display.
Upvotes: 1
Reputation: 4880
Note: these settings are located in WooCommerce > Settings > Products > Display
Now that all thumbnail image sizes for our specific theme are known, we can add new dimensions to ensure that future thumbnails will be this size or larger.
In WooCommerce > Settings > Products > Display, be sure that the maximum image sizes are at least as big as the dimensions your theme is rendering for those thumbnails. Then Save Changes.
Any new product images that are uploaded will now have thumbnails in these settings, and should appear without distortion or blurriness.
Note: Saving changes does not automatically update all previously uploaded product imagery. To update old images, WordPress needs to regenerate the thumbnails. A great plugin that does just that is Regenerate Thumbnails.
Upvotes: 0