Problem: You want the translation column to always be visible on the WooCommerce product list in the admin area, but even after using a code snippet to unhide the column, no data is displayed in it. Solution: We recommend implementing a custom function to ensure the 'icl_translations' column is always visible and contains data. Here's a step-by-step guide: 1. Add the following function to your theme's functions.php file or a custom plugin:
Please test this solution in a staging environment before applying it to your live site, as this custom code is a courtesy and not officially supported by us.
If this solution does not resolve your issue or seems outdated, 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 further assistance is needed, please open a new support ticket at WPML support forum.
Problem: The client is using a custom script to update stock and prices of products via the WooCommerce API. This script updates only the main language, and while the stock and prices reflect correctly across all languages, the translations for product names and descriptions are reset to match the main language. Solution: 1. We recommend checking if the 'save_post' hook is being executed after updates. This hook helps ensure that changes are properly synchronized across translations. 2. Verify if the WPML translation editor is disabled for the products. If it's not, any save in the default language might reset manually added translations. For more details on using different translation editors, visit Using Different Translation Editors for Different Pages. 3. If products were duplicated using WPML's 'Translation Management', check the post meta table for 'icl_duplicate_of' and delete if any entries are found. This can prevent content from syncing/duplicating incorrectly on save.
If these steps do not resolve the issue or if the solution seems outdated or irrelevant 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 the problem persists, please open a new support ticket at WPML support forum.
Problem: The client needed to customize the hover effect color of the language button from black to blue (#002fa7) and the background color of the alternative language options from grey to light blue (#B3E5FF) in WPML.
Solution: We fixed this by adding the following CSS code in the WordPress Customizer under Appearance -> Customize -> Additional CSS:
Please note that this solution might be outdated or not applicable to your specific 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 this does not resolve your issue, please open a new support ticket at WPML support forum.
Problem: You are trying to capture the language of the customer in WooCommerce orders using WPML, but the meta key 'wpml_language' does not work. Solution: The correct meta key to use is 'wpml_languages', which is stored in the 'wp_wc_orders_meta' table. This key reflects the language of the order based on the active user language at the time the order is created on the frontend. Here is how you can retrieve the language from the 'wpml_languages' meta key:
$order = wc_get_order( $order_id );
// Retrieve the 'wpml_languages' meta value
$wpml_languages = $order->get_meta( 'wpml_languages' );
// If the data is serialized, unserialize it
if ( !empty( $wpml_languages ) ) {
$languages = unserialize( $wpml_languages );
// Assuming the first entry is the primary language of the order
$order_language = isset( $languages[0] ) ? $languages[0] : null;
// Output or use the $order_language
echo 'Order language: ' . $order_language;
}
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your specific 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 further assistance is needed, please open a new support ticket at WPML support forum.
Problem: The client is developing a site using a Blocksy child theme and has implemented custom code for WooCommerce warnings in a file named 'ufi-warnings.php'. This code adds a product tab for UFI warnings and allows selection of UFI numbers for products. The client used WPML to translate the product tab into Slovenian and scanned the child theme for custom code translations from Croatian to Slovenian. However, the client encountered issues with the text domain in localization functions. Solution: We advised the client to ensure that all hard-coded strings in their PHP code are wrapped in WordPress localization functions like
__()
and
_e()
, and to specify the text domain as a string. This is crucial for the parsing tools to correctly distinguish between different text domains. The client was incorrectly using a variable for the text domain, represented as
If this solution does not resolve your issue or seems irrelevant due to updates or differences in your case, please open a new support ticket. We also 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.
Problem: The client has a Google review widget on their website, translated into four languages using different JavaScripts for each language. They face an issue where every time the page is updated, the JavaScripts for other languages revert to the main language, requiring manual adjustments each time. Solution: We recommend not using JavaScript code in the glossary as WPML does not support translating JavaScript natively. Instead, you can use WPML's filters and action hooks to manage multilingual support. Here's how you can proceed: 1. Remove the JavaScript code from the glossary. 2. Write custom code to detect the current language and insert the appropriate JavaScript code. You can find guidance on this through the following documentation links:
If you need professional help to implement this, consider hiring a WPML-certified contractor from this list.
If this solution does not apply to your case, or if it seems outdated, 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 issues persist, please open a new support ticket.
Problem: The client needed the Finnish, Latvian, and Lithuanian flags in their WPML language switcher to link to external partner sites instead of internal translations, but the existing jQuery code was not functioning. Solution: We recommended adding a custom function to the
functions.php
file of the client's theme. This function modifies the language switcher to include external links for the specified languages. Here is the code to implement:
Please ensure to back up your site fully before implementing this solution. If this solution does not resolve your issue or seems outdated, we 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 further assistance is needed, please open a new support ticket.
Problem: The client is working on a site with multiple domains using WPML and WooCommerce for regions like the USA, UK, and Germany. They want to restrict customers from ordering from certain domains based on their shipping address, but the WooCommerce option 'Sell to all countries, except for…' applies globally and does not allow for domain-specific restrictions. Solution: We recommend using custom hooks to achieve domain-specific restrictions. One approach is to use the
woocommerce_checkout_process
hook to check the current domain against the customer's shipping country. If there is a mismatch, display an error and prevent checkout. Alternatively, consider redirecting customers to the correct store based on their location or using third-party plugins like Conditional Shipping and Payments for more flexibility.
It's important to note that restricting EU customers based on their shipping address might violate EU price discrimination laws, particularly under the Geo-blocking Regulation (EU) 2018/302. This regulation prohibits unjustified geo-blocking and discrimination based on nationality, residence, or place of establishment within the EU. Ensure compliance when implementing any restrictions.
If this solution does not apply to your case, or if it seems outdated, 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 further assistance is needed, please open a new support ticket at WPML support forum.