I love that many eCommerce plugins for WordPress make it easy to set up and launch a shop without tons of configuration. However, as you’re running your shop, you may want to fine-tune what the plugin does, such as change colors, product page display, how images are presented, or other parts of your site.

One change that shop owners tend to make is to update the messages or content in their shop. For example, what does your shop say to a customer if the cart is empty? What if they’ve tried to create an account but they already have one? You can use these messages to echo your brand’s tone and tailor them to your shop.

Many times, plugins will make this content easy for you to change by placing filters around messages or text (such as “Add to Cart” text), which can be used to change this content programmatically. For example, you can change the tab names on WooCommerce product pages using a filter. I could change the tab name for the “Additional Information” tab if desired:

WooCommerce Product Tabs

By adding a custom code snippet, I can shorten it to “Additional Info” instead:

function sww_custom_tab_title( $heading ) {
    $heading = 'Additional Info';
    return $heading;
}
add_filter( 'woocommerce_product_additional_information_tab_title', 'sww_custom_tab_title' );

WooCommerce updated product tabs

These filters allow you to make site-wide changes in your content or messaging so your shop blends in with the overall tone of your site.

However, there’s not always a filter in place to change the text you’re looking for. In that case, you can usually translate the text instead, and there’s a very useful plugin to help you change shop messages via translation: Say What.

When to Translate Text

While translating text isn’t the optimal solution to this problem (using filters or actions is better), it’s an easy way to make a change to your site’s content that couldn’t otherwise be made. You can translate text to change it if (1) no filter exists to help you achieve this, and (2) you don’t need to translate your site content via a multilingual plugin.

If you’re using a translation plugin to provide a multi-lingual site, you don’t want to use this method and you’ll have to override templates or find a workaround instead. Since you’ll actually be using the translations in that situation, you don’t want to then override them in one language only. If your site is only available in one language, then this will work for you.

We’ll also need to ensure that translation is possible to use this method, as not every string is the same in code as it is on the frontend of your site (it could contain HTML or other variables). I recommend searching the .pot file usually to see if a string is translatable (search for a couple key words from the phrase). If you’re looking through the plugin source code instead, you’ll look for text wrapped in __(), _e(), or _x() functions.

Using Say What to Change Text

The Say What plugin will perform translations on the fly so that you can update text on your site on a per-string (per phrase) basis.

Let’s take an example of text that can’t be changed via filter, but can be translated. If you look at an empty cart page for a WooCommerce site, you’ll see a generic empty cart message:

WooCommerce empty cart text

Original empty cart text

First, let’s see if we can change this via a filter. The easiest way to see if there’s a filter is to search the plugin folder or public repository (here’s the one for WooCommerce) for this phrase. When I search the WooCommerce repository for this empty cart phrase, I find that it’s part of the empty cart template, and that there’s no filter available to change this text.

It is, however, translatable since it’s wrapped in our _e() function (or we could have checked the .pot file for this string if we hadn’t found a filter). This means we can “translate” this text to replace it with our own content instead of displaying a boring, lifeless message. We’ll use Say What to change it by going to Tools > Text Changes in our admin after installing it. We’ll enter the original string and what we’d like to change to:

Say what plugin

Enter text changes

And now we’ll see these changes on the frontend of our site:

New Cart Text

New Empty Cart text

Note that you must enter the original string exactly the way it is in the plugin or .pot file in order to translate it. This is where things can get tricky, and I recommend checking out the .pot file to see what the original string contains (for example, if there’s HTML you should replicate in your new string).

Text Domains

The last part of our translation is to use the text domain for your plugin. Each plugin has a unique text domain, and this can usually be found in the plugin documentation or by opening up the main plugin file in your text editor. For example, if I’m looking at Easy Digital Downloads, I can open up the plugin’s folder and look at top of the easy-digital-downloads.php file to see the text domain (or search that folder for textdomain).

Here’s a list of text domains for some major plugins to get you started:

WooCommerce: woocommerce
WP eCommerce: wpsc
Easy Digital Downloads: edd
Shopp: Shopp
Jigoshop: jigoshop
Exchange: it-l10n-ithemes-exchange
MarketPress: mp
WP eShop: eshop

This should help you customize the tone of content and messages throughout your shop so that even your empty cart or error notices reflect your brand.

Articles you may also like:

Posted by Beka Rice

Beka Rice manages the direction of Sell with WP content and writes or edits most of our articles to share her interests in eCommerce. Or she just writes as an excuse to spend more time jamming out to anything from The Clash to Lady Gaga. Who knows.