Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing an issue where translated products are redirecting to the my account page when the B2BKing Pro plugin is activated. This issue does not occur when the plugin is deactivated.

Solution:
We have identified that the issue is related to the visibility settings of products, which are managed by the B2BKing Pro plugin. These settings are not being copied over to the translated products correctly.

1. Check the B2BKing Pro settings to ensure that product visibility is correctly configured for the default language.
2. In the WPML settings, locate the Custom Term Meta Translation section to identify which term fields are responsible for product visibility.
3. Set the translation preferences for these term fields to 'Copy' so that the visibility settings are automatically copied to the translated product categories.

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.

Tagged: 

This topic contains 14 replies, has 2 voices.

Last updated by nickK-27 1 year, 7 months ago.

Assisted by: Nigel.

Author Posts
October 11, 2023 at 10:59 am #14558505

nickK-27

Tell us what you are trying to do?
When trying to view translated products are redirecting to my account page. All the other pages and articles are working as expected.

The problem occurs only when the plugin b2bking pro is activated.
When plugin is inactive translated products are working just fine.

Any ideas?
Thanks

October 11, 2023 at 11:18 am #14558697

Nigel
WPML Supporter since 02/2016

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

Hi there

I'd need to see if I can reproduce the same on a test site and could then take a closer look to try and identify the root cause.

The B2BKing Pro plugin is listed as compatible with WPML, and the one reported issue isn't related to what you describe: https://wpml.org/plugin/b2bking/

Do you have a copy of the plugin I can use for testing? (You can share a zip of the plugin files via Dropbox, Wetransfer or similar; links added here are automatically hidden.)

Otherwise I can ask our Compatibility team to contact the plugin authors and request a copy.

October 11, 2023 at 11:30 am #14558867

nickK-27

Hello,

Sure, here is the latest version from codecanyon: hidden link

You will also need the free core version from wordpress repository https://wordpress.org/plugins/b2bking-wholesale-for-woocommerce/

With the author of the plugin we have added a custom function for our needs. I paste it here from my function.php file (just in case it makes any difference):

add_filter('b2bking_b2b_group_for_pricing', function($group_id, $user_id){

// check this is a b2b user
$is_b2b = get_user_meta($user_id,'b2bking_b2buser', true);
if ($is_b2b === 'yes'){
$group_id = 33250;
}
return $group_id;
}, 10, 2);

Thanks for your fast reply

October 11, 2023 at 11:43 am #14558937

Nigel
WPML Supporter since 02/2016

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

Thanks for that.

Adding and activating the plugins isn't sufficient to trigger the problem, it either requires the involvement of some other plugin, or perhaps the theme, or depends on some settings applied to the plugins. (That custom code doesn't look relevant.)

Do you have a staging server where we can do some basic testing?

Let me mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.

Any particular product I can look at to see the problem?

October 11, 2023 at 12:46 pm #14559577

Nigel
WPML Supporter since 02/2016

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

I can see the problem on the production server, but I don't want to change anything there, I'll look into the issue on your staging server when it's ready.

You can edit your previous private reply to add details for the staging server.

October 17, 2023 at 10:31 am #14593011

nickK-27

Hi Nigel,

Did you find any solution?

October 17, 2023 at 11:42 am #14593617

Nigel
WPML Supporter since 02/2016

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

Sorry, I didn't get a notification about updating the credentials, I'm looking at the issue on the dev server now.

October 17, 2023 at 11:59 am #14593931

Nigel
WPML Supporter since 02/2016

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

The problem persists, even when disabling other plugins and switching theme, and I've been through pretty much all of the B2BKing settings to see if any would account for the 302 redirect that occurs on the translated products, to no avail.

The only way left that I can see to identify the cause of that will be to step through the code execution when loading such a page, which I would need to do locally. As I can't reproduce the problem on a test site is it okay to take a copy of your site to install locally for this?

October 17, 2023 at 12:04 pm #14593949

nickK-27

Sure, no problem.
As i don't use ftp, i edited my private reply and gave you credentials to login to the server
Let me know if you need anything else

October 18, 2023 at 9:07 am #14600547

Nigel
WPML Supporter since 02/2016

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

Just to let you know I had some problems getting a copy of your site installed locally yesterday, but I tried with a different plugin this morning and that has worked, and I see the issue on my local site, so I have something to work with.

I'll get back to you.

October 18, 2023 at 9:12 am #14600689

nickK-27

Thanks Nigel for letting me know.
I appreciate your help so far.

October 18, 2023 at 10:10 am #14601485

Nigel
WPML Supporter since 02/2016

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

I have isolated where in the B2BKing Pro code it is triggering the redirect, and it relates to the visibility (or otherwise) of products.

It is a lengthy section of code, but it seem to check product visibility based on some combination of product category term meta and user meta for the current user.

Currently, it is checking the "visibility" of the translated product and concluding it should not be shown, hence the redirect.

Because I didn't manage to reproduce this on a clean test site, I guess that it must be related to the particular settings for B2BKing Pro on your site.

I'm not familiar with the plugin. Do you recall applying any kind of settings that would affect product visibility? (It seems you would have somehow declared products to be visible in the default language, and the settings relating to this are not getting copied over to the translated product. I'm trying to track down what those settings are.)

October 18, 2023 at 10:38 am #14602375

nickK-27

Oh man, you are completely right!

See the screenshots with the gr category and the translated one

B2b didn't copy the visibility settings!

Thank you so much for your time and your help.
I guess i have to manually add the settings to each category and subcategory

en.JPG
gr.JPG
October 18, 2023 at 10:46 am #14602657

Nigel
WPML Supporter since 02/2016

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

I think this is stored as term meta (custom fields belonging to taxonomy terms) by B2BKing Pro.

If you are able to identify which term fields are responsible you could set their translation preferences to Copy so that when the product categories are translated the B2BKing settings get copied across automatically.

The screenshot shows what I found in WPML > Settings > Custom Term Meta Translation.

Screenshot 2023-10-18 at 11.43.21.png
October 18, 2023 at 10:48 am #14602697

nickK-27

Perfect!
Thank you so much