This thread is resolved. Here is a description of the problem and solution.
Problem:
You are trying to synchronize product translations on your site to ensure that the prices of products in the original language match those of the translated products. However, you are facing issues with some prices not being up to date and some being misordered when sorting by price on the translated product pages.
Solution:
1. Ensure that "WooCommerce Multilingual & Multicurrency" is enabled. This should resolve the price issues for most products.
2. Navigate to WooCommerce > WooCommerce Multilingual & Multi-Currency > Products.
3. Filter the translation status to "Needs update".
4. Update the product translations now.
Note: It appears that some products that need updates were never fully translated to 100%. The setting "Translatable use translation if available or fallback to default language" might be causing untranslated products to display in the default language.
Regarding the ordering by price issue, it might be due to different market prices for each product, causing the second language to query the highest price available on the translated product instead of the lowest.
If this solution does not resolve your issue or seems outdated, we 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 problems persist, please open a new support ticket.
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.
Tagged: WCML
Related documentation:
This topic contains 10 replies, has 2 voices.
Last updated by davidL-207 1 week, 4 days ago.
Assisted by: Andreas W..
Author | Posts |
---|---|
November 4, 2024 at 9:10 am #16359425 | |
davidL-207 |
<b>Background of the issue: </b> <b>Symptoms: </b> <b>Questions: </b> |
November 4, 2024 at 9:13 pm #16363437 | |
Andreas W. Supporter Languages: English (English ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
Hello, Please take a backup of your site incl. database. Now, add this snippet to the end of the functions.php file of your theme and go to Products > All Products. add_action( 'admin_init', 'save_all_products_on_products_page' ); function save_all_products_on_products_page() { global $pagenow; // Check if we're on the Products > All Products page if ( $pagenow == 'edit.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'product' ) { // Get all the products $args = array( 'post_type' => 'product', 'posts_per_page' => -1 ); $all_posts = get_posts( $args ); // Loop through all the posts and update them foreach ( $all_posts as $single_post ) { wp_update_post( $single_post ); } add_action( 'admin_notices', 'bulk_save_products_notice' ); } } // Function to display an admin notice function bulk_save_products_notice() { ?> <div class="notice notice-success is-dismissible"> <p><?php _e( 'All products have been successfully updated.', 'textdomain' ); ?></p> </div> <?php } Now, remove the snippet again. This snippet should have saved all your products in all languages. Best regards |
November 5, 2024 at 10:03 am #16365284 | |
davidL-207 |
Hello, I think my server is not able to handle this type of request because I get an internal server error 500. After investigating, it seems that it is the "min_price" and "max_price" in the "wp_wc_product_meta_lookup" table that causes the sorting problem. In addition, I use the "content-egg" plugin that lists the best offers in different stores Disabling WCML solves all the problems but I don't know if I will really be able to continue without it because apparently I can't translate the attribute names without WCML. Hoping to have been clear enough, I look forward to your help and advice. Best regards |
November 5, 2024 at 2:02 pm #16367155 | |
Andreas W. Supporter Languages: English (English ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
Please try to connect to the server, open the wp-config.php and adjust the WP MEMORY LIMIT to 256M. define( 'WP_MEMORY_LIMIT', '256M'); Now, try to run this slightly adjusted snippet: add_action( 'admin_init', 'save_all_products_on_products_page' ); function save_all_products_on_products_page() { global $pagenow; // Check if we're on the Products > All Products page and if the action has already run if ( $pagenow == 'edit.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'product' && !isset($_GET['bulk_save_done']) ) { // Get all the products $args = array( 'post_type' => 'product', 'posts_per_page' => -1 ); $all_posts = get_posts( $args ); // Loop through all the posts and update them foreach ( $all_posts as $single_post ) { wp_update_post( $single_post ); } // Add admin notice add_action( 'admin_notices', 'bulk_save_products_notice' ); // Redirect to the same page with a flag to prevent rerunning wp_redirect( add_query_arg( 'bulk_save_done', '1' ) ); exit; } } // Function to display an admin notice function bulk_save_products_notice() { ?> <div class="notice notice-success is-dismissible"> <p><?php _e( 'All products have been successfully updated.', 'textdomain' ); ?></p> </div> <?php } |
November 5, 2024 at 2:39 pm #16367426 | |
davidL-207 |
I get an internal server error 500 again, even having adjusted the WP MEMORY LIMIT to 512M. |
November 5, 2024 at 2:57 pm #16367606 | |
davidL-207 |
As I told you, the website works fine without WCML so I'm definitely thinking of disabling it, the only problem is that I can no longer translate the product attributes name in "WPML > String translation" or in "WPML > Taxonomy translation". Is it because I started translating these attributes using WCML or something else? |
November 5, 2024 at 6:35 pm #16368810 | |
Andreas W. Supporter Languages: English (English ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
I would like to offer to have a closer look at the problem and request temporary access (wp-admin and FTP) to the website to investigate this issue further. You can find the required fields below the comment section when you log in to leave the next reply. The information you provide is private, which means only you and I can see and access it. IMPORTANT I may have to install a plugin called "All In One WP Migration" to make a copy of the website where I can investigate the issue further. However, I would also be very grateful if you could provide a staging site or copy of the website from your server yourself for this purpose. This step would only be required if the issue is replicable on such a staging site. If you have any questions about creating such a staging site, you can consult your hosting provider. Just take note that WPML should be registered on this site again. If you are unable to provide such a copy of the site for testing, please let me know on this ticket. The private response form looks like this: Next time you reply, click "I still need assistance." Video: Please note that we are obliged to request this information individually on each ticket. We may not access any access information not specifically submitted on this ticket in the private response form. |
November 6, 2024 at 9:05 pm #16374709 | |
Andreas W. Supporter Languages: English (English ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
While reviewing the archive I see that the prices seem to be fine. Take note again, that you always need to update the translation after editing the original product. About the order: I will be taking a copy of the site for running some tests and then get back to you. |
November 7, 2024 at 5:04 am #16375135 | |
davidL-207 |
"While reviewing the archive I see that the prices seem to be fine." I invite you to take a look at these attached screenshots. I have plenty of other examples if you want. |
November 7, 2024 at 6:46 pm #16379639 | |
Andreas W. Supporter Languages: English (English ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
Due to the high amount of product on your site I can not suggest using a script to update everything in bulk. 1) Make sure "WooCommerce Multilingual & Multicurrency" is enabled and this should already solve the price issues. At least it solved it for one of your provided examples, but I did not confirm them all. 2) Go to WooCommerce > WooCommerce Multilingual & Multi-Currency > Products. 3) Filter the translation status to "Needs update". 4) Update now the product translations It seems like some of those products that currently need an update were actually never yet translated to 100%. There are only 326 translated French products. The other products displayed in French are actually the original products, as you are using the setting "Translatable use translation if available or fallback to default language". Are you not planing to translate all the products? About the ordering by price issue: I can offer a WPML test site on which we could try to recreate this issue for further escalation but I will need you to provide the theme and any necessary plugins in this case. |
November 8, 2024 at 4:14 am #16380476 | |
davidL-207 |
Thanks for your feedback. Indeed, I only translated 326 products because I wanted to fix these issues before continuing and as you noticed, due to the large amount of products on my site, I preferred to use the setting "Translatable use translation if available or fall back to default language" to allow the display of products that are not yet translated. I disabled "WooCommerce Multilingual & Multicurrency" because all the problems come from the fact that it prevents the price of the translated product from updating itself. Since I do not plan to use a second currency, I do not think it is really an issue. In conclusion, there are two things that I find totally disconcerting: 1. I find it disappointing that they don't give us the choice to ignore the price fields in "WooCommerce Multilingual & Multicurrency" especially since the setting exists but is locked for a reason that is beyond me. 2. The fact of being forced to use "WooCommerce Multilingual & Multicurrency" to translate the attribute labels when we can translate the attribute terms in "WPML > Taxonomy translation". Thanks again for your help, maybe you could pass this information on to the relevant departments because I would be really surprised if I were the only one wanting to translate a price comparison website. Best regards |