This thread is resolved. Here is a description of the problem and solution.
Problem: If you're experiencing a 504 Gateway Time-out error when trying to update a variable product with WPML and WooCommerce activated, the issue might be related to the server not receiving a timely response from an upstream server it needed to access. Solution: First, ensure you have the latest version of the WPML plugin and its add-ons. You can find the latest versions in the 'My Account -> Downloads' section of the WPML website. For instructions on how to update, please visit http://wpml.org/faq/install-wpml/. Remember to back up your database before updating, using a plugin like Duplicator (http://wordpress.org/plugins/duplicator/).
Additionally, try increasing the PHP Max Input Vars on your server to 10000.
We've made some improvements in the latest release of WooCommerce Multilingual plugin.
If the solution provided here is irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket in the WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
I appreciate your patience. We have tested your case and escalated it to our development team.
As a temporary workaround, we made the following changes on your staging site in /wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-variations-data.php in line 219, the following function:
public function get_variation_id_by_lang( $lang, $original_variation_id ) {
return $this->wpdb->get_var(
$this->wpdb->prepare(
"SELECT post_id FROM {$this->wpdb->postmeta} AS pm
JOIN {$this->wpdb->prefix}icl_translations AS tr ON tr.element_id = pm.post_id
WHERE tr.element_type = 'post_product_variation'
AND tr.language_code = %s
AND pm.meta_key = '_wcml_duplicate_of_variation'
AND pm.meta_value = %d",
$lang,
$original_variation_id
)
);
}
is changed to
public function get_variation_id_by_lang( $lang, $original_variation_id ) {
return apply_filters( 'wpml_object_id', $original_variation_id, 'product_variation', false, $lang );
}
Could you increase the PHP memory limit, Max input vars, and Max execution time on your staging server and then try to update your product?
Hi there, thank you. Below you'll see the server values indicated under Tools -> Site health / Info. Looking at the values, I'd say that PHP memory limit etc. are suffiencient. I tried to update the product Abiturzeugnis, but again I got an 504 Gateway Time-out. So why do you think that replacing that one function would solve the problem? BTW: When I run "Synchronize attributes and update product variations", the process is never completed and loops forever (I had it running over night ...). Please advise, Frank
Server architecture Linux 4.19.0-17-amd64 x86_64
Web server Apache
PHP version 7.4.33 (Supports 64bit values)
PHP SAPI cgi-fcgi
PHP max input variables 4000
PHP time limit 180
PHP memory limit 1024M
PHP memory limit (only for admin screens) 512M
Max input time 60
Upload ize 256M
PHP post 256M
cURL version 7.64.0 OpenSSL/1.1.1n
Is SUHOSIN installed? No
Is the Imagick library available? Yes
Are pretty permalinks supported? Yes
Your product has a large number of variations, totaling to 1440, which causes a delay in the time it takes to save. Even without WPML, it takes a considerable amount of time to save, thus by replacing the existing function, the time to save has been reduced to approximately 1.5 minutes in the local environment. However, the value of the maximum execution time exceeds the limit, which causes the saving\updating process to stop.
I just retested and see that it saves in several seconds with all WPML plugins enabled. I have tested with product ID 7499 (the product that you provided as an example). Could you please test it again? Thank you.
That is because I deleted a lot of variations of that product to see if updating works with less variations. If you try updating product 22606 for example, you'll get a timeout error with "WPML Multilingual CMS" activated. If you deactivate it, updating works perfectly. Frank
Please give me another example of such a product. I still encourage you to try to increase some parameters on the server I mentioned before in order to test this.
You can also try product 10578: updating the product will give you a timeout error with "WPML Multilingual CMS" activated. If you deactivate it, updating works 100%.
I've increased PHP max input vars from 4000 to 16000. Updating product 22606 now works after minutes of waiting, Updating product 10578 (has more variations) still doesn't work (504 Gateway Time-out). "WPML Multilingual CMS" is extremly slowing down the process. Please advise - Frank
I appreciate your patience as we work to resolve your issue. Unfortunately, we do not have an immediate solution. However, we have already escalated your case to our development team. We cannot provide a timeframe for a resolution as it depends on several factors.
In the meantime, we recommend avoiding product variations if they are not in use. You can also try increasing other parameters on the server as a temporary workaround.
Thank you! Yes, I'm deleting unused variations, however, there are only a few products where there unused variations to delete. For now, my temporary workaround is to deactivate "WPML Multilingual CMS" before updating my products and then to reactivate it afterwards - which is not acceptable of course. Looking forward to your solution. Frank