Resolved
Reported for: WooCommerce Multilingual & Multicurrency 5.0.2
Overview of the issue
If you use WooCommerce’s built-in import feature, whenever you import a CSV file and run the import process for the default language, it does not update the prices for product translations.
Workaround
As importing products does not execute the save_post action, we need to run it manually:
- Go to the Products page.
- Select your products.
- Open the Bulk Actions dropdown.
- Select the Edit option and click Apply. This launches the synchronization process.
Alternatively, you can add the following code into your functions.php file. Then, the next time you run the import, prices will be synchronized automatically
add_action( 'woocommerce_product_import_inserted_product_object', function( $product ) { do_action( 'save_post', $product->get_id(), get_post( $product->get_id() ) ); } );
Thank you, I will test the code with the next update.
Perfect! Please let us know if it works. 🙂
The code works well if you have only single products. If you have other type of products (bundled products, gift cards… generated by third-party plugins, for example), it also turns those product into “single”, and you have to edit those products individually again. For anyone reading this, I recommend the first workaround, and leaving special products (bundled, gift cards…) unchecked prior to bulk editing.
Hope WPML incorporates a csv-importing workflow properly, soon. Thank you and keep up with the good job!
Thank you very much for your feedback, Pablo. Indeed this code is intended for native WooCommerce products, for other third party plugins it is better the 1st approach.
I can confirm, this works like a charm!
I’m glad to know it helped. 🙂
Hi Andres, I do not get it to work. I put the code in active themes folder, but after that the import of the CSV keeps hanging. Wonder if I put it in the correct line in the functions.php file. I put it in the beginning and at the end, but it did not work either way. After removing the lines, it is back to the old situation. I will try the bulk update now
Also when I put the code in with Snippets, the updating keeps ‘hanging’. Even with a test file with just one product. Any idea?
With the bulk option it is done by page with about 20 products. In my case I have to do that 10 times. But anyway it works. But than after that in WPML -> Translations it is mentioned that the products need to be updated, even there is no update needed
Hello! If the snippet hangs, then perhaps it is a better idea to use the first workaround. Our developers are aware of the issue and it is being worked on. When a fix is released, this page will be updated.