79287326

Date: 2024-12-17 09:40:47
Score: 1
Natty:
Report link

A rather clean solution I found:

add_filter( 'gettext', function( $translated_text, $text, $domain ) {
    if ( 'woocommerce' === $domain && '%s in cart' === $text ) {
        $translated_text = ' %s';
    }
    return $translated_text;
}, 10, 3 );

I had tested translation, but I was expecting "%d in cart" which was wrong and I thought that's out of question. With "%s in cart" it works. I removed the "in cart" text and added the icon using a ::before psuedo-element.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: ordett