Hi @zappob,
Please follow this article to change the text in our plugin.
Regards,
Thread Starter
ZappoB
(@zappob)
Hello and thank you for your answer.
I added the following script with the plugin Snippets:
add_filter( 'gettext', 'wpc_translations', 99, 2 );
function wpc_translations( $translation, $text ) {
if ( $text === 'Please select a purchasable product in the component' ) {
return 'Die gewählte Option bei';
}
if ( $text === 'before adding to the cart.' ) {
return 'ist aktuell nicht verfügbar';
}
return $translation;
}
It seems to have no effect at all: the text is not translated.
I haven’t tried Loco, as I wanted to stay away from another plugin for just one need.
Any further suggestions? Did I made a mistake in the script?
Best Regards,
Zappo
Hi,
Please use below snippet instead:
add_filter( 'gettext', 'wpc_translations_14548545', 99, 2 );
function wpc_translations_14548545( $translation, $text ) {
if ( $text === 'Please select a purchasable product in the component [name] before adding to the cart.' ) {
return 'Die gewählte Option bei [name] ist aktuell nicht verfügbar.';
}
return $translation;
}
Use the “[name]” in your text to show the dynamic component name.
Thread Starter
ZappoB
(@zappob)
Sorry for the late reply, the second snippet works fine.
Many thanks!