This thread is resolved. Here is a description of the problem and solution.
Problem:
The client was experiencing issues with saving and creating multi-language products with several hundred variations, which was taking a long time to complete.
Solution:
1. We confirmed that the issue had been tested on a site clone and the changes were working.
2. We instructed the client to edit a specific file by navigating to "Plugins -> Plugin Editor" and overwriting the mentioned code lines, emphasizing the importance of making a backup before making any changes.
3. We informed the client that we could not provide an ETA for the release that includes these changes, as the priority might be lower due to the lack of similar reports from other clients.
4. We updated the files on the client's site and asked the client to try saving the product again, noting that it should now take around 30 seconds without getting "stuck".
If you're experiencing a similar issue, we recommend you try the steps mentioned above. However, please be aware that this solution might be irrelevant if it's outdated or not applicable to your case. We highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket with us.
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.
Related documentation:
This topic contains 33 replies, has 3 voices.
Last updated by Marcel 1 year, 2 months ago.
Assisted by: Marcel.
Author | Posts |
---|---|
February 7, 2024 at 4:19 pm #15277774 | |
Marcel WPML Supporter since 02/2019
Languages: English (English ) German (Deutsch ) Timezone: Europe/Madrid (GMT+02:00) |
Hi, We will try it locally using the copy. Could you please check the user on the server again? I tried your credentials, and they also didn't work. We can also have another look at the server settings. In the meanwhile, we well test locally. Thank You! Best Regards |
February 7, 2024 at 5:01 pm #15278020 | |
Javier |
Hello, when you install the copy on your own servers, you can use the profile I sent you yesterday: Imagine I don't know why the profile bobbywpml does not work on the production server (mine) but if you do restore on your server, you can use "Imagine" which should work with the password I provided; I will be online to assist if you need more help. Thanks |
February 7, 2024 at 5:17 pm #15278112 | |
Marcel WPML Supporter since 02/2019
Languages: English (English ) German (Deutsch ) Timezone: Europe/Madrid (GMT+02:00) |
Hi, no worries about the user for the local installation. We can create our own via WP-CLI. With the credentials you provided on the production site, I received: Error: The password you entered for the username Imagine is incorrect. Lost your password? Is there might a Geoblock active? Thanks! Best Regards |
February 8, 2024 at 9:54 am #15280326 | |
Marcel WPML Supporter since 02/2019
Languages: English (English ) German (Deutsch ) Timezone: Europe/Madrid (GMT+02:00) |
Sure, thank you! |
February 8, 2024 at 12:36 pm #15281265 | |
Marcel WPML Supporter since 02/2019
Languages: English (English ) German (Deutsch ) Timezone: Europe/Madrid (GMT+02:00) |
Hi, the databases in the wp-snapshot folder are missing many records, like empty post tables, etc. Therefore, they are not runnable. Can you please provide is with a fresh DB export? We thought about asking you for permission to download it from the live site, but the WPEngine rules are pretty strict there: hidden link. Thank You! Best Regards |
February 8, 2024 at 5:28 pm #15282611 | |
Marcel WPML Supporter since 02/2019
Languages: English (English ) German (Deutsch ) Timezone: Europe/Madrid (GMT+02:00) |
Hi, it worked with another .SQL file in /wp-content. It was truncated in the editor, but it contained all the records. We tested with product post ID 41103, and we got 2.63 minutes to save. If you agree, we will try this on the live site to see if WP Engine might kill the query before it runs in the timeout. Please let us know. Best Regards |
February 9, 2024 at 4:27 pm #15286995 | |
Javier |
Hello Marcel, that is great news. Sure, please do the same with the product in the live environement, you have an access already with the User: WPML |
February 9, 2024 at 4:39 pm #15287026 | |
Marcel WPML Supporter since 02/2019
Languages: English (English ) German (Deutsch ) Timezone: Europe/Madrid (GMT+02:00) |
Hi, thank you! We logged the slow queries, and there were none, so most of the problem came from PHP. We created a new internal development ticket for this case. We tested the product, saving time with just WooCommerce and no plugin/no WPML; it still takes around 30 seconds, so it can not be reduced to a few seconds. The reason is simple: WooCommerce is saving all the 676 variations, so WPML will. But we made a few adjustments, and I see almost the same time as without WPML when saving the translation in our Classic Translation Editor: You can try the following: $this->woocommerce_wpml->sync_product_data->sync_product_stock( wc_get_product( $original_variation_id ), wc_get_product( $variation_id ) ); with $original_variation_obj = wc_get_product( $original_variation_id ); if (!is_null($original_variation_obj->get_stock_quantity())) { $this->woocommerce_wpml->sync_product_data->sync_product_stock( $original_variation_obj, wc_get_product( $variation_id ) ); } 2) Edit wp-content\plugins\woocommerce-multilingual\inc\class-wcml-products.php line 126 and replace public function is_downloadable_product( $product ) { $product_id = $product->get_id(); $cache_key = 'is_downloadable_product_' . $product_id; $found = false; $is_downloadable = $this->wpml_cache->get( $cache_key, $found ); if ( ! $found ) { if ( $product->is_downloadable() ) { $is_downloadable = true; } elseif ( $this->is_variable_product( $product_id ) ) { foreach ( $product->get_available_variations() as $variation ) { if ( $variation['is_downloadable'] ) { $is_downloadable = true; break; } } } $this->wpml_cache->set( $cache_key, $is_downloadable ); } return $is_downloadable; } with public function is_downloadable_product( $product ) { $product_id = $product->get_id(); $cache_key = 'is_downloadable_product_' . $product_id; $found = false; $is_downloadable = $this->wpml_cache->get( $cache_key, $found ); $saving_job = defined('DOING_AJAX') && DOING_AJAX && 'wpml_save_job_ajax' === $_REQUEST['action']; if ($saving_job && !$found && get_option('_transient_timeout_' . 'wcml_is_downloadable_product_' . $product_id) > time()) { $is_downloadable = get_transient('wcml_is_downloadable_product_' . $product_id); $found = true; } if ( ! $found ) { if ( $product->is_downloadable() ) { $is_downloadable = true; } elseif ( $this->is_variable_product( $product_id ) ) { foreach ( $product->get_available_variations() as $variation ) { if ( $variation['is_downloadable'] ) { $is_downloadable = true; break; } } } $this->wpml_cache->set( $cache_key, $is_downloadable ); if (!$saving_job) { set_transient('wcml_is_downloadable_product_' . $product_id, $is_downloadable, 24 * HOUR_IN_SECONDS); } } return $is_downloadable; } If you switch to our Advanced Translation Editor, the performance will also improve even more with these changes. Does this work for you? Best Regards |
February 9, 2024 at 5:24 pm #15287174 | |
Javier |
Hello Marcel, thank you for your efforts and for your feedback. |
February 9, 2024 at 5:26 pm #15287177 | |
Javier |
Also, I don't understand this: "If you switch to our Advanced Translation Editor," |
February 9, 2024 at 5:45 pm #15287226 | |
Marcel WPML Supporter since 02/2019
Languages: English (English ) German (Deutsch ) Timezone: Europe/Madrid (GMT+02:00) |
Hi, please consider this as a temporary workaround. So if it works for you, we can plan a release to fix it permanently. As I mentioned, our developers are looking for a solution to this. As the solution is applied to code that controls the translation editor part, it will not be called when using the Advanced Translation Editor. Best Regards |
February 9, 2024 at 6:01 pm #15287231 | |
Javier |
I see. I don"t have a developper so I would need to hire one for this and then presumably have those modifications rolled back too I guess. How long would the permanent fix via update take? I am also worried that I can't even be sure those modifications would work until they are implemented on our site via a third-party developper. We were planning on working on these kind of products next week, I have staff specially employed for that they won't be here for a permanent stay. Best Regards, Javier Petrement |
February 12, 2024 at 10:51 am #15292292 | |
Marcel WPML Supporter since 02/2019
Languages: English (English ) German (Deutsch ) Timezone: Europe/Madrid (GMT+02:00) |
Hi Javier, I'm not sure why you need a developer here. We tested this already on the site clone, and the changes work. We asked you to confirm that we are 100% sure the issue is solved and that we are not overseeing anything. You basically need to edit the file and overwrite the code. If you need help, I can assist you here, but this should not require help from an external developer, as it's just opening "Plugins -> Plugin Editor" and overwriting the mentioned code lines. If you make a backup before, nothing can go wrong. We can't give an ETA for a release where the changes are included. It depends on how many people are affected, and no other clients have reported this problem right now. Therefore, the priority would be lower. Best Regards |
February 12, 2024 at 3:07 pm #15293878 | |
Javier |
Hello Marcel, thank you very much for your work on this critical topic. Yes, please do edit those lines of code in the plugins editor (I don't know how to do this). I have made a full backup a few minutes ago so you can please proceed. This is the only way we can confirm that the fix works... Please confirm back when it is done and you have tested the product with the fix (or ask me to do that). Best Regards, Javier Petrement |
February 12, 2024 at 6:25 pm #15294470 | |
Marcel WPML Supporter since 02/2019
Languages: English (English ) German (Deutsch ) Timezone: Europe/Madrid (GMT+02:00) |
Hi Javier, the files are changed. Please try to save the product now yourself. Remember that it will still need around 30sec, but it will not get "stuck": As you can see here, the updates are viewable after saving for secondary languages: hidden link. Best Regards |