Search code examples
wordpresswoocommercepolylang

How to set different product images for different languages in multilingual WooCommerce and polylang website?


I have a multilingual website using woocommerce and polylang pro and polylang for woocommerce add-on. Due to a number of reasons, I want to set different product image for different languages . For example, I want to set pic1.jpeg for a specific product in English and at the same time, I want to set pic2.jpeg for the same product in french. But there is a problem. when i change the product image for one language, it automatically synchronized in all languages. By any chance, does anyone know how to fix this?

In polylang setting page, I unchecked the synchronize option but I got no success to achive my goal.


Solution

  • I've experienced this problem before as well and Polylang gave me the following reply which fixed my problem:

    *By default, and as you experienced, the product images are automatically synchronized.

    However, it is possible for you to unsynchronized the featured image of your products in order to have 1 featured image per language.

    In order to have different featured images and variations for your translated products you will need to add a wpml-config file (Polylang reads this file) in your wp-content directory.

    To do so please follow the few steps below:

    1. Create a “polylang” directory inside your WordPress “wp-content” directory (all minuscule, no special character or spaces)
    2. Add the wpml-config.xml attached.
    3. Then simply return to your products and update the featured images in the translated products.

    Note that If you don't want to unsynchronized the product image gallery too, just remove the line : _product_image_gallery The line with the _thumbnail_id option is used to unsynchronized the product image and the product image of the variation.*

    The wpml-config.xml file that was included in the reply contained the following lines:

    wpml-config example

    Good luck with your website!