Skip Navigation

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

Last updated by annaT-15 1 year, 9 months ago.

Author Posts
June 28, 2023 at 11:54 am #13909773

annaT-15

Tell us what you are trying to do? Replace text in pricing summary box of Woocommerce Advanced Product Fields plugin and translate the new words in WPML. According to developer of the WAPF plugin WPML should pick up the new words in string translation but it does not.
The below code snippet is added via a plugin.
When I search in string translation it only finds the actual code snippet.
Please advise what needs to get fixed in order to make the new text translatable.

add_filter('wapf/html/product_totals', 'wapf_change_totals_text', 10, 2);
function wapf_change_totals_text($html, $product) {
return str_replace(
array(__('Product total','sw-wapf'), __('Options total','sw-wapf'), __('Grand total','sw-wapf')),
array(__('Product subtotal','sw-wapf'), __('Additional options total','sw-wapf'), __('Product total, plus shipping','sw-wapf')),
$html
);
}

Is there any documentation that you are following? hidden link

Is there a similar example that we can see? hidden link

What is the link to your site? see above.

Screenshot 2023-06-22 180151.jpg
June 28, 2023 at 12:04 pm #13909853

Dražen
Supporter

Languages: English (English )

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

Hello,

thanks for contacting us.

You should add the code to your theme/child theme functions.php, and make sure it works fine in default language. Not via the Code snippet plugin.

Then scan the theme via WPML → Theme and Plugins Localization and translate them via WPML String translation.

- https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/#strings-arent-selected-for-translation

Let me know when done.

Regards,
Drazen