Skip to content Skip to sidebar

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 6 replies, has 2 voices.

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

Assisted by: Waqar Ali.

Author Posts
October 30, 2023 at 10:03 am #14689795

nickK-27

I have B2b King installed and separate stock for b2b clients and b2c.

When translating products clicking on the "Translate woocommerce products", the b2b stock is not copied and is set to 0. Besides that, when a b2b customer purchases a product the stock is removed from the second language and not from the default. The b2c purchases are working fine.

Solution: By duplicating the product and then translate it, it seems to be working.

My question:
We already translated around 350 products manually before we notice this behavior. Is there any solution to duplicate those products (so the b2b stock will be the same on both languages) or we have to delete them and start over?

October 30, 2023 at 12:44 pm #14691205

Waqar Ali

Hi,

Thank you for contacting us and I'd be happy to assist.

I'll recommend the following steps:

1. Please go to WP Admin -> WPML -> Settings and scroll down to the 'Custom Fields Translation' section.

2. In the 'Search for' field, type 'b2bking_' and it will show the custom fields added by the B2b King.

3. Look for the custom field that is used for the stock value and change it to 'Copy' option, so that the value remains in sync between the original and the translated posts.

Here is a useful guide on selecting the correct options for the translatable custom fields:
https://wpml.org/documentation/getting-started-guide/translating-custom-fields/

I hope this helps and let me know how it goes.

regards,
Waqar

October 30, 2023 at 12:49 pm #14691327

nickK-27

Hi,
Thank you for your reply.
I'm afraid this is not an option. B2b king saves the stock value in variables, so i have the same amount of variables as my products (sreenshot).

Can i mass select copy all those variables?

b2b.JPG
October 31, 2023 at 12:02 pm #14699405

Waqar Ali

Thanks for writing back.

Can you please confirm if changing this option for some of the products actually fixes the issue?

Once confirmed, I'll try to see if some workaround can be adopted to update this option in bulk/mass for all the products.

November 7, 2023 at 10:00 am #14745465

nickK-27

Hi,
Sorry for the delayed reply.
I can confirm that i found the custom field that i needed to, and after copying it, the new translated products are copying the stock. But this is true only for the new added products.
So the question still remains. Is any way to apply this setting to the old translated products?

Thank you for your help so far

November 9, 2023 at 1:01 pm #14767091

Waqar Ali

Thanks for the update and glad that it is working for the new products.

I've performed some further testing and research, but couldn't find any built-in function or hook to trigger the update of those custom fields for the already added products.

You can open the edit screen of any one of the existing products and then click the 'update' button.
( you don't have to make any change to the product )

If the stock option is successfully synced with the translated product, you can repeat that for all of the existing products too.

November 9, 2023 at 1:16 pm #14767301

nickK-27

Thank you so much,
I just tested it and it works great.

Thanks again