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 Mihai Apetrei 1 year, 7 months ago.

Assisted by: Mihai Apetrei.

Author Posts
September 7, 2023 at 3:54 pm #14361601

oliverS-63

Hello WPML Support,

I have the following code snippet hardcoded in my functions.php file:

add_filter( 'woocommerce_cart_item_price', 'kd_custom_price_message' );

function kd_custom_price_message( $price ) {
$afterPriceSymbol = ' zzgl. MwSt. und Versandkosten';
return $price . $afterPriceSymbol;
}

I want to add a get text function to it, but there is a syntax error appearing.

Maybe you can help me out with this one.

Best regards!

September 8, 2023 at 1:08 pm #14366871

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi there.

Please take a look here:
https://developer.wordpress.org/themes/functionality/internationalization/#add-text-domain-to-strings

Practically, you need to add everything inside "__()" and also add a "text-domain", so something like this:

__( 'zzgl. MwSt. und Versandkosten', 'any-text-domain-you-want' )

Also, you will need to re-scan the theme or the plugin that you are adding the code to once again:
https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/#scanning-the-theme-and-plugins

I hope that you will find this information helpful. 🙂

Mihai Apetrei