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.

This thread is resolved. Here is a description of the problem and solution.

Problem: I am trying to import products translations with REST API, I only have one language active

Solution: Please follow this documentation for how to create products: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/

Also, I believe you will need the secondary language, otherwise the translated product will be created in the default language.

Relevant Documentation: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/

This topic contains 4 replies, has 2 voices.

Last updated by salvadorC 1 year ago.

Assigned support staff: Lauren.

Author Posts
October 1, 2018 at 10:03 am #2777666

salvadorC

I am trying to: Import woocommerce products and their translations with REST API.

Link to a page where the issue can be seen: hidden link

I expected to see: products in both languages

Instead, I got: Two equal products in default language

October 1, 2018 at 10:04 am #2777668

salvadorC

More errors:
Fatal error: Uncaught WCML_REST_Invalid_Language_Exception: Parámetro de idioma no válido: "en" in /usr/home/rilylab.es/web/wp-content/plugins/woocommerce-multilingual/classes/rest-api-support/class-wcml-rest-api-support.php:211

Stack trace:

#0 /usr/home/rilylab.es/web/wp-includes/class-wp-hook.php(288): WCML_REST_API_Support->set_product_language(Object(WC_Product_Variable), Object(WP_REST_Request))

#1 /usr/home/rilylab.es/web/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)

#2 /usr/home/rilylab.es/web/wp-includes/plugin.php(453): WP_Hook->do_action(Array)

#3 /usr/home/rilylab.es/web/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-rest-crud-controller.php(214): do_action('woocommerce_res...', Object(WC_Product_Variable), Object(WP_REST_Request), true)

#4 /usr/home/rilylab.es/web/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-rest-controller.php(149): WC_REST_CRUD_Controller->create_item(Object(WP_REST_Request))

#5 /usr/home/rilylab.es/web/wp-includes/rest-api/class-wp in /usr/home/rilylab.es/web/wp-content/plugins/woocommerce-multilingual/classes/rest-api-support/class-wcml-rest-api-support.php on line 211

October 1, 2018 at 10:08 am #2777676

salvadorC

One important thing. At this time I only got default language active.
Thanks!

October 2, 2018 at 6:16 pm #2782465

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thank you for contacting WPML support. I'll be happy to help you with this.

Please follow this documentation for how to create products: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/

Also, I believe you will need the secondary language, otherwise the translated product will be created in the default language.

Please let me know if you need any further assistance and I will be happy to help.

October 5, 2018 at 9:43 am #2790211

salvadorC

My issue is resolved now. Thank you!