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.

Our next available supporter will start replying to tickets in about 2.20 hours from now. Thank you for your understanding.

This topic contains 1 reply, has 2 voices.

Last updated by Bruno 1 year, 7 months ago.

Assigned support staff: Bruno.

Author Posts
October 15, 2018 at 12:38 pm #2817465


I need to get/loop shop products with all translated posts

I am using wp_qery

We are using wp-json to return products for our mobile applications. We need to loop product and get the translated posts with each post.

The code is on local

October 16, 2018 at 11:33 pm #2822548


Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Thank you for contacting us. Please, my sincere apologies for the delay in answering.

You will need to loop the products in the original language and then verify that the product is translated to then display the translated product. You can use the "wpml_object_id" hook to do this and see more information in our documentation:

Another option should be to use the WPML API to convert the loop to the secondary language, for example:

global $sitepress;

// switch to the desired language, French for example
$sitepress->switch_lang( 'fr' );

// makes the loop
$loop = new WP_Query( 'post_type=product' );

// revert to the current language
$sitepress->switch_lang( ICL_LANGUAGE_CODE );

As this is a custom feature, unfortunately, this is beyond the scope of our support. We have a list of WPML and WooCommerce Multilingual hooks that can help you develop such feature, which can be seen in the links below:


If you prefer, you can contact one of our certified partners who can develop small to large features for your site:

Thank you.