Discussions

Change "cart" to "Basket"

Hi

How can I change "Add to cart" to "Add to Basket", "Shopping cart" to "Shopping Basket" and so on?

Basically, because I'm developing a UK website, I'm looking to change each instance of "cart" to "basket" as that is more appropriate for this country.

Thanks.

Richard

Posted: Jul 22, 2011

Comments

UserFriendly on August 30, 2011

That seems to work in most places. However the message that appears when a product is added still says "your cart" (it's linked to the cart page) even though I've set "your cart" to be replace with "your basket" in String Overrides. Any idea how to go about changing this as well? Not much use if it's not going to be consistent.

Thanks.

purplemonkey on August 31, 2011

I did this by using Find and (Selective) Replace tools on my dreamweaver. You can set it to search for a string in file within a folder structure. Click Find and then hit replace is you find a valid match. i.e. text outputs.

I know thats a pretty basic way to do it, but it works.

purplemonkey on August 31, 2011

yep updating is definitely the down side to it. I am slowly learning learning Drupal, but finding it pretty tricky to do what I would consider simple things.

I am using the durpal install which contains the Commerce module pack, its called "Commerce KickStart"

With this I start my search in Profiles\commerce_Kickstart folder, I use full recursive search so all files in all folders are searched. If I had just added the commerce modules manually I would search the Sites\All\modules folders, cause thats where your downloaded modules 'should' reside.

hope it helps.

UserFriendly on September 7, 2011

Thanks. I searched the commerce module folder which helped me identify exactly what strings to enter in the Sting Overrides module settings page. I would definitely recommend using that module over find & replace.

:)

flortjes on September 22, 2011

I would use the Drupal Locale and Content Translation modules for this.

You can then set up a new language (British English) and simply translate all sentences with "cart" in it (and any other American English terms).

I'm actually doing this just now and might export the translation files and post this somewhere at some point.

UserFriendly on September 7, 2011

I've managed to get this done with the String Overrides module. Here are the strings and their replacements (notice I've had to replace !cart-url with the actual site-relative path):

%title added to <a href="!cart-url">your cart</a>.
%title added to your <a href="/cart">shopping basket</a>.

%title could not be added to your cart.
%title could not be added to your shopping basket.

%title removed from your cart.
%title removed from your shopping basket.

Add to cart
Add to Basket

Shopping cart
Shopping Basket

Update cart
Update Basket

Your shopping cart has been updated.
Your shopping basket has been updated.

Your shopping cart is empty.
Your shopping basket is empty.

Shopping cart contents
Shopping basket contents

Just the url to sort now, which should hopefully just be a case of using some kind of redirect code/module.

Thanks for all the help.

Jason Martino on September 28, 2012

Added the following to local.settings.php because we use Aeigr and you can't edit settings.php. Anyway same difference.

$conf['locale_custom_strings_en'][''] = array(
'Add to cart' => 'Add to Shopping Bag',
);

spoetnik on February 18, 2012

Never used it, but it must be possible to add some string overrides in your settings.php

<?php
/**
 * String overrides:
 *
 * To override specific strings on your site with or without enabling locale
 * module, add an entry to this list. This functionality allows you to change
 * a small number of your site's default English language interface strings.
 *
 * Remove the leading hash signs to enable.
 */
# $conf['locale_custom_strings_en'][''] = array(
#   'forum'      => 'Discussion board',
#   '@count min' => '@count minutes',
# );
?>

PedroKTFC on February 20, 2012

I had an analogous problem when I actually wanted to get rid of the button itself, have a look at http://www.drupalcommerce.org/node/2528. I solved it by using hook_form_FORM_ID_alter() and I'm sure you could use it too, try:

function mymodule_form_commerce_cart_add_to_cart_form_alter (&$form, &$form_state, $form_id) {

// Change the text on the Add to Cart submit button

$form['submit'] = array('#value' => t('Add to basket'));

}

No promises though, I haven't tried it but I'm reasonably confident! :) Good luck.

tripper54 on September 15, 2012

Thanks for sharing that list of overrides - it saved me a bit of poking around!

Jason Martino on September 28, 2012

$conf['locale_custom_strings_en'][''] = array(
'Add to cart' => 'Add to Shopping Bag',
'Enter Quantity' => 'Quantity',
'Shopping cart' => 'Shopping Bag',
'Update cart' => 'Update Bag',
'Your shopping cart has been updated.' => 'Your Shopping Bag has been updated.',
'Your shopping cart is empty.' => 'Your Shopping Bag is empty.',
'Shopping cart contents' => 'Shopping Bag contents',
'Item successfully added to your cart' => 'Item successfully added to your bag',
);