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.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Long Nguyen 1 year, 11 months ago.

Assisted by: Long Nguyen.

Author Posts
July 26, 2023 at 7:15 pm #14106625

yuryE

Good afternoon, we recently purchased a subscription to automatic translation for your site, we translated almost everything except for one thing, this thing is due to the fact that we added an additional feature to our template when the price of the product is zero instead of the price of zero, it says that “the price is available on request”

For this feature, we have added a new function to the child version of the template:

function filter_woocommerce_empty_price_html($price, $_product) {
if ($_product->get_price() == 0) return __('<span class="woocommerce-Price-amount amount"> the price is available on request </span>');
return $price;
}
add_filter( 'woocommerce_empty_price_html', 'filter_woocommerce_empty_price_html', 10, 2 );

Is it possible to somehow add information about the input that if in Russian then the phrase will be different, if in Latvian then the phrase will be different, If in Lithuanian then the phrase will be different and so on…

THANK YOU!

rrrrrrrrr.jpg
July 27, 2023 at 3:36 am #14107571

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Yury,

Thank you for contacting WPML support, I'd be happy to help you with this issue.

You are using a custom code to display the custom text if the price is empty. I would like to inform you that helping you with custom code, is out of the scope of WPML, but I suggest you can try:

1. Add the text domain to the gettext __() function, "avada-child" for example:

function filter_woocommerce_empty_price_html($price, $_product) {
if ($_product->get_price() == 0) return __('<span class="woocommerce-Price-amount amount"> the price is available on request </span>', 'avada-child');
return $price;
}

2. Go to WPML > Theme and plugins localization > Scan strings in the child theme.

3. Go to WPML > String Translation > Translate that string into other languages.

Refer to the documentation
https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/
https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/

If you are not able to accomplish this, I would recommend you contact one of our certified partners that will be more than happy to help you with this. In this link, you will find a list of our certified partners: https://wpml.org/contractors/

Look forward to your reply.
Thanks