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 1 reply, has 2 voices.

Last updated by Bruno Kos 7 months ago.

Assigned support staff: Bruno Kos.

Author Posts
March 20, 2019 at 10:11 pm

ioannisK-18

Dear Support,

We are setting up our eshop and when we import a product in english we want it to duplicate in greek, which it's not.

More specifically,

We have a WP_Cron job which retrieves some products from another system via web services and inserts the new products at WooCommerce or updates them if already exists. The WP_Cron is scheduled to be executed every 1 hour.
When we insert a new product, we want to duplicate this product to the Greek language. The product is duplicated but neither the attributes, nor the variations are duplicated.
If we manually duplicate the product everything is working properly.
If we execute the process without WP_Cron (click on a button and wait for the process to complete) again everything is working properly.
We have tried to fix the issue to another WooCommerce installation with the Twenty Sixteen theme and just the WooCommerce and WPML installed but without success.
So, the question is how can we duplicate the product via WP_Cron.

Many thanks
Panos

March 21, 2019 at 9:49 am #3397621

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

Can you tell me if you can try this?
https://wpml.org/forums/topic/cron/#post-876903

You can test implementations with duplicates being created both from the front and backend:
https://wpml.org/wpml-hook/wpml_make_post_duplicates/
https://wpml.org/wpml-hook/wpml_admin_make_post_duplicates/

I think that in some situations, it does not work for the frontend calls (not creating variations and attributes), so a function with the backend call might be a better alternative.

Regards,
Bruno Kos