Remove “Items” Text Beside Divi Cart – Only Display Cart Icon + Number

The default Divi + WooCommerce menu shopping cart consists of a cart icon, the number of items and the text “Items”. Let’s make the menu cleaner by removing the “Items” text.

Join +3 860 subscribers!

Before

Cart icon and 0 Items

Cart icon ” with “Items” or “Item” text.

After

Cart number without "Items" text

Cart icon without “Items” or “Item” text.

The Problem: No Option To Hide “Items” Beside The Cart

It’s easy to display the shopping cart icon and the cart quantity in Divi. But regardless if you use the Theme Builder menu or the Theme Customizer menu, you’ll face the same problem: There is no option available to disable the “Items” text to the right of the cart. Luckily, there are couple of ways to remove the “Items” text from the cart.

1. Method 1: Remove The “Items” Text With A Free Plugin

There is a nice free plugin called Say What? that lets you to change and remove text strings in WordPress without using custom code. If you aren’t a developer, it can be hard to know which strings to target. You could either use Say What Pro to discover and autocomplete strings. Or you can simply keep on reading this post, because I’ve found the right strings for you. And yes, it works both for Theme Builder and Theme Customizer menus.

  1. Install and activate the free plugin Say What? from the WordPress plugin repository
  2. Go to Tools » Text changes from your WordPress dashboard
  3. Click Add New in the top left corner
  4. Now, add these values in the fields:
    Original String: %1$s Items
    Text domain: Divi
    Text context: WooCommerce items number
    Replacement string: %1$s
    Hide Items text beside the Divi cart
  5. Save by clicking the Add button
  6. Click Add New again and add these values:
    Original String: %1$s Item
    Text domain: Divi
    Text context: WooCommerce items number
    Replacement string: %1$s
    Hide Item text beside the Divi cart
  7. Save by clicking the Add button

That’s it! The final result should look like this:

Change the cart Items text in the Divi

Clear your website cache and test it by adding products in your cart in frontend. The “Items” text should not be displayed beside the Divi cart anymore.

Why two lines of strings?

If there are zero or multiple items in a cart, the default text is “Items“. The first row targets this string. If there is one single product in the cart, the default text is “Item“. The second row targets this string.

Method 2: Remove The “Items” Text With A Code Snippet

If you don’t want to install an extra plugin, you can add a snippet to the functions.php file instead. To avoid that the code is overwritten next time you update Divi, you need to have a child theme installed. 

  1. Start by editing functions.php in your child theme folder (/wp-content/themes/your-child-theme/)
  2. Add the snippet below:
// Hide Item and Items text beside Divi cart
add_filter('ngettext_with_context', 'change_woocommerce_item_text', 20, 6);

function change_woocommerce_item_text($translation, $single, $plural, $number, $context, $domain) {
    if ($domain == 'Divi' && ($translation == '%1$s Item' || $translation == '%1$s Items')) {
        return '%1$s';
    }
    return $translation;
}

Save and preview in frontend. You might have to clear the website cache, browser cache and Divi Static CSS cache before you can see the changes in frontend.

That’s all for today!

I hope that you enjoyed this post. Subscribe to DiviMundo on YouTube and join our Facebook group for more crisp content on WordPress and web design.

👉 Related post: Hide Cart (or “0 Items”) When Empty In Divi & WooCommerce

👉 Free course: Create a website from scratch with Divi

Related posts

5 Comments

  1. Hello Victor, you are amazing. Thank you so much for this tutorial.

    But I do find some issues, the word “items” does flash up for a few seconds (while the page is loading) before it disappears (page fully loaded) which does not look great.

    I hope this could be fixed, thank you for your time.

    Reply
    • Thanks for the feedback Eric! Did you use method 1 (the “Say What?” plugin”) or method 2 (the code snippet)? I can’t recreate the flash effect when using method 1. If you use method 2 there will be a brief flash when the page loads, so I would recommend method 1.

      Reply
  2. Method 2 is not working anymore.
    Not with code snippets or trough functions.php

    Is there a solution for Method 2?

    Reply
  3. Method 2 does not work anymore. Especially when updating the cart via the basket, this is overridden.

    Reply
  4. the reason this does not work for all is a language issue
    I vs i
    you have to adapt the function

    // Hide Item and Items text beside Divi cart
    add_filter(‘ngettext_with_context’, ‘change_woocommerce_item_text’, 20, 6);

    function change_woocommerce_item_text($translation, $single, $plural, $number, $context, $domain) {
    if ($domain === ‘Divi’ && (strcasecmp($translation, ‘%1$s Item’) === 0 || strcasecmp($translation, ‘%1$s Items’) === 0)) {
    return ‘%1$s’;
    }
    return $translation;
    }

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Affiliate Disclaimer

All content on DiviMundo is funded by you – our beloved readers. Some of the links are affiliate links. This means that if you click on the link and purchase something, I will receive an affiliate commission. But it will never cost more for you. Thanks for your support!

Victor Duse, founder of DiviMundo