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 topic contains 2 replies, has 2 voices.

Last updated by Wannes 4 months, 3 weeks ago.

Assigned support staff: Radu.

Author Posts
May 22, 2019 at 10:25 am #3864273

Wannes

I'm (programmatically) creating products in the default language (fr) and then creating a copy for dutch using your wpml_admin_make_post_duplicates action.

Afterwards I change the product name of the dutch product to the dutch product name and slug (because it is not the same as the french name).

When updating the product I update the duplicate with the following code:
add_action( 'woocommerce_update_product', 'pronti_woocommerce_update_product', 10, 1 );
function pronti_woocommerce_update_product( $id ){
$product_exists_language_information = apply_filters( 'wpml_post_language_details', NULL, $id );
if( $product_exists_language_information['language_code'] == 'fr' ) {
do_action( 'wpml_admin_make_post_duplicates', $id );
}
}

This also changes the dutch name back to the french one. Is there a way to update the dutch without changing the product name?

Is there any documentation that you are following?
https://wpml.org/wpml-hook/wpml_admin_make_post_duplicates/

May 22, 2019 at 12:00 pm #3864941

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Wannes,

Have you tried to use this hook separate, not when the French products are created? Maybe some elements are not built yet and that's why you have this problem. Also, can you give me an example of some meta that are not duplicated in the second language, please? I want to check this out on my side and see how it's working.

Thanks,
Radu

May 23, 2019 at 10:04 am #3873263

Wannes

My issue is resolved now. Thank you!