Edit the word “Item” in WooCommerce (in Divi theme)

av tonny on 12/03/2016

Updated 2016.11.09

I had problems translating the word Item in my Woocommerce Divi install.
So I did it in the Divi functions.php fil.

I change this:

_nx( ‘1 Item’, ‘%1$s Items’, $items_number, ‘WooCommerce items number’, ‘Divi’ )

to this:
_nx( ‘1 vare’, ‘%1$s varer’, $items_number, ‘WooCommerce items number’, ‘Divi’ )

And then I moved the code snippet to my Divi child theme so that my translation would not be written over at the next Divi theme update. I moved all this:
(Beware that the %2$s that is a link should not be a link, please check the image at the bottom of the post to see the correct code for that part of the snippet)

// —————————————– Translate the word Items to vare

if ( ! function_exists( ‘et_show_cart_total’ ) ) {
function et_show_cart_total( $args = array() ) {
if ( ! class_exists( ‘woocommerce’ ) ) {

$defaults = array(
‘no_text’ => false,

$args = wp_parse_args( $args, $defaults );

$items_number = WC()->cart->get_cart_contents_count();


esc_url( WC()->cart->get_cart_url() ),
( ! $args[‘no_text’]
? esc_html( sprintf(
_nx( ‘1 vare’, ‘%1$s varer’, $items_number, ‘WooCommerce items number’, ‘Divi’ ),
number_format_i18n( $items_number )
) )
: ”

// —————————————–

Correct code:

{ 1 kommentar… les den eller skriv en selv }

Thorsten 01.03.17 at 17:26

Thx for this really helpful hint. I spend tons of time for solving this issue previously.

Skriv en kommentar

Du kan bruke disse HTML taggene og attributtene: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Previous post:

Next post: