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 Raja Mohammed 2 weeks ago.

Assigned support staff: Raja Mohammed.

Author Posts
October 2, 2019 at 4:35 pm

User7887

I am trying to:
Deleting a Product that has variations and the translation.

I expected to see:
Deleted product and the translated version.

Instead, I got:
Only deleting of product but the translated version still remain.
---
Important:
->I checked: When deleting a post, delete translations as well
->Works if i do that with wordpress's backend, but not when i use Woocommerce API
-> The call that i do is: $woocommerce->delete("products/$product->id", ['force' => true ]);

October 3, 2019 at 10:54 am #4686941

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello there,

I will try to assist you with the ticket.

Rest API is not yet 100% supported with WooCommerce multilingual, As of now retrieving products and order information is possible with WCML. Regarding your request, you might need to add some additional code extending the Rest API class to delete the translated products as the setting in the WPML will apply only for those actions carried from the WordPress backend.

As of now, the feature is not supported, I would suggest sending a feature request through our dedicated page https://wpml.org/suggest-a-new-feature-for-wpml/.

Alternatively, you can try fetching the translated product id using wpml_object_id filter and delete the product in a separate request
https://wpml.org/wpml-hook/wpml_object_id/

Kind regards
Raja