I need to remove this item count text in my orders table at the my account page, because I don't need it:
The text at Gesamtsumme should be changed from:
234,35€ for 1 Artikel
to
234,35€
I've tried it with deleting it in the file but I want to do this via my functions.php because this is better I think.
The correct way to make it work for singular and plural item count, for all languages is (where $text
is the untranslated string):
add_filter('ngettext', 'remove_item_count_from_my_account_orders', 105, 3 );
function remove_item_count_from_my_account_orders( $translated, $text, $domain ) {
switch ( $text ) {
case '%1$s for %2$s item' :
$translated = '%1$s';
break;
case '%1$s for %2$s items' :
$translated = '%1$s';
break;
}
return $translated;
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.