- Status
- Resolved
- Reported for
- WPML Multilingual & Multicurrency for WooCommerce 4.6.1
- Resolved in
- 4.6.2.1
Overview of the issue
It is possible to encounter a problem with WPML Multilingual & Multicurrency for WooCommerce 4.6.1 and possibly previous releases as well.
The error manifests itself with the following timeout:
PHP Fatal error: Maximum execution time of 60 seconds exceeded in /wp-includes/class-wp-hook.php on line 288
Workaround
The problem is caused by having a meta key of _thumbnail_id with value equal to 0 (zero).
You can check that with this query:
SELECT * FROM `wp_postmeta` WHERE `meta_key` = '_thumbnail_id' AND `meta_value` = '0';
As a workaround, you can remove these values from the database OR apply the following patch:
1. Go to the ../wp-content/plugins/woocommerce-multilingual/inc/ folder and edit the class-wcml-products.php file.
2. Find the following line:
if( is_product() && !$this->woocommerce_wpml->products->is_original_product( $product_id ) ){
3. Change that line to:
$is_original_product = $this->woocommerce_wpml->products->is_original_product( $product_id );
if( is_product() && !$is_original_product ){
4. Now, find the following line:
} elseif ( '_product_image_gallery' === $meta_key ) {
5. Change that line to:
} elseif ( '_product_image_gallery' === $meta_key && !$is_original_product ) {
6. Finally, find the following line:
} elseif ( '_thumbnail_id' === $meta_key ) {
7. Change that line to:
} elseif ( '_thumbnail_id' === $meta_key && !$is_original_product ) {
8. Save the file and test.