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: The user was not able to render the vendor page translation, it only shows the primary language content, and the language switcher was not working for vendor page Solution: This is a compatibility bug. 2 patches were suggested in: - https://wpml.org/forums/topic/unable-to-translate-the-vendors-individual-page-2/#post-4259909 - https://wpml.org/forums/topic/unable-to-translate-the-vendors-individual-page-2/#post-4265747

This topic contains 11 replies, has 2 voices.

Last updated by Reza 2 months, 3 weeks ago.

Assigned support staff: Jamal.

Author Posts
July 18, 2019 at 6:18 am #4235187

Reza

I am using WC vendor plugin

We have single page for each vendor and we want it to be multilingual.

But since it is an user I am unable to achieve this!

Can you please help me with this?

Please refer the following url for the same
hidden link

July 18, 2019 at 9:08 am #4236381

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for contacting WPML Support. I will be glad to help with this.

Can you please paste your WPML Debug information in the Debug information field?
- http://wpml.org/faq/provide-debug-information-faster-support/

I am not sure, but I think that WC vendor is using a custom taxonomy for vendors, which should be translatable in WPML. Please check taxonomy translation settings in WPML->Settings. Can you share a screenshot?

Best regards,
Jamal

July 19, 2019 at 10:09 am #4245581

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello Reza,

My apologies, I first thought you are using WooCommerce Vendors by Automattic which uses taxonomies. Now I see that's WC Vendors Marketplace which uses users as vendors.

I think that first, you will need to set the users that you want to translate by roles in WPML->String Translation, at the bottom of the page. Then the user data will be available to translation in String Translation under the domain Authors, see the attached images.

I hope this helps. Let me know if you still need assistance on this.

Best regards,
Jamal

July 19, 2019 at 12:13 pm #4246259

Reza

Hello Jamal,

Thank you for the update I have followed the steps provided by you to translate the author description via WPML -> String Translation.

Still, the language switcher is unable to display/translate the translation. Please check the below URLs displays English content only.

URL:
hidden link
hidden link

Please provide some solution or option to archive.

July 19, 2019 at 1:37 pm #4246751

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

I have checked it, I even tried with a default theme and the issue is still there. I suspect that it is probably a compatibility issue between WC Vendors and WPML. To check that, I created a test server. Please use the following URL to log in. hidden link

Please configure WPML similarly to your website, install only WC Vendors. Create a vendor and translate its information and use a default theme like Twenty seventeen. If the issue is present there too, I'll escalate this to our compatibility team for further analysis and eventually a fix.

Best regards,
Jamal

July 22, 2019 at 4:21 am #4253761

Reza

Hello Jamal,

Thank you for the support.

I will check on the provided sandbox setup and will revert back to you once I am done.

July 22, 2019 at 5:42 am #4254083

Reza

Hello Jamal,

I have configured the WPML & WC vendor plugin on the demo server by using a default theme.

I am facing the same issue. The language switcher is unable to translate the translation. Please resolve the issue asap or provide some solution.

July 22, 2019 at 9:42 am #4255549

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for your collaboration. I am now escalating this ticket to our compatibility team for further analysis and eventually a fix.
I'll get back to you as soon as possible.

Best regards,
Jamal

July 22, 2019 at 4:41 pm #4259909

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Our compatibility team has worked on the issue and suggest a patch to solve this. But as we did not fully reproduce the issue on the sandbox I am afraid if it won't work smoothly on your website.
First, we had to use our filter wpml_translatable_user_meta_fields to register the fields for translation. For example, the vendor shop description was not translated in the sandbox, that's why I say it was not fully reproduced. The language switcher is not working too, and it is working on your website.
https://wpml.org/wpml-hook/wpml_translatable_user_meta_fields/

First, we added the following code to the theme's functions.php to register Vendors fields for translation.

function add_favorite_food_user_field( $user_meta_fields ) {
    $user_meta_fields[] = 'pv_shop_description';
	$user_meta_fields[] = 'pv_shop_name';
	$user_meta_fields[] = 'pv_shop_slug';
	
    return $user_meta_fields;
}
add_filter( 'wpml_translatable_user_meta_fields', 'add_favorite_food_user_field' );

Then we translated the fields on String Translation under the domain "Authors".

Then we patched the WC Vendors Marketplace plugin by replacing line 271 in wp-content/plugins/wc-vendors/classes/front/class-vendor-shop.php replace line 271 with:

'shop_description' => apply_filters( 'wpml_translate_single_string', $shop_description, 'Authors', 'pv_shop_description_' . $vendor_id),

Check this page hidden link

The patch has helped to translate the shop description.

Let me know how it goes on your website.

Best regards,
Jamal

July 23, 2019 at 6:09 am #4262811

Reza

Hello Jamal,

Thank you for the update. The patch works for the website.

The language switcher is not working, which is getting redirected to shop page instead of translation version. If you find any patch or filter to achieve that do let me know.
Thanks.

July 23, 2019 at 11:52 am #4265747

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

The compatibility team has found a patch to make the language switcher work. But first, let's see how to also translate the shop name, change line 270 with:

'shop_name'        => apply_filters( 'wpml_translate_single_string', $shop_name, 'Authors', 'pv_shop_name_' . $vendor_id),

To work around the language switcher issue, the compatibility team has suggested a piece of code to add in the theme's functions.php file. Please add the following:

function custom_lang_switcher ($langs) {
	if (WCV_Vendors::is_vendor_page()) {
		$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
		$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
		$link = WCV_Vendors::get_vendor_shop_page( $vendor_id );
		foreach ($langs as $l => $lang) {
			$langs[$l]['url'] = apply_filters( 'wpml_permalink', $link, $l);
		}
	}
	return $langs;
}
add_filter ('icl_ls_languages', 'custom_lang_switcher', 100);

Please check the sandbox to see how this is working. Let me know if there is anything else needed.

Best regards,
Jamal

July 24, 2019 at 5:13 am #4270431

Reza

My issue is resolved now. Thank you!

Please mention in the new update of WPML, the compatibility issue with WC vendor plugin is fixed so that I can update both the plugin in future.