BEFORE

AFTER

If you setup a WooCommerce store on the Extra Theme, then Extra’s header will display a count of the items in the user’s cart. The text for this will be of the form “2 Items”, with a corresponding “2 Items in Cart” tooltip. If you’d like to change this text, e.g. to translate it into another language, you can use the following PHP code:

add_filter('ngettext', 'change_woocommerce_item_text', 20, 5);
function change_woocommerce_item_text($translation, $single, $plural, $number, $domain ) {
    if ($domain == 'extra') {
		if ($translation == '%d Item') { return '%d Article'; }
		if ($translation == '%d Items') { return '%d Articles'; }
		if ($translation == '%d Item in Cart') { return '%d Article dans le Panier'; }
		if ($translation == '%d Items in Cart') { return '%d Articles dans le Panier'; }
    }
    return $translation;
}

As this is PHP code, you can add it to the functions.php of a child theme, or using a plugin such as Code Snippets. Please take a backup prior to adding PHP code to your site, so that you can restore the original version if necessary.

The code above example replaces the English text (both singular and plural forms) with the French equivalent (I hope – please correct me if I have mistranslated). It also translates the longer form of the text (i.e. %d Items in Cart) which appears in a tooltip if you hover over the cart. The %d in the above is a placeholder which will be replaced with the actual number of items when Extra outputs the page.