Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using WooCommerce with free Artificer theme and I'm trying to change the text for My Basket and Checkout shown on image below: enter image description here

Now, I've searched the localization files for any string matching My Basket (all possible variations) and came to conclude that this isn't possible to translate using language file. Since this basket information is visible on every page I went to look into the header.php file in the themes/artificer folder and comparing to the HTML output (using Dev tools in Chrome) I came to believe the output is controlled by this line:

<?php woo_nav_before(); ?>

But, now I've spent some reasonable amount of time googling and searching the template files for where this function is defined but I can't find it for the life of me, so can someone please point me in the right direction.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

The functions are defined in the includes folder of the artificer theme, in the theme-woocommerce.php file:

// Add the cart link to the header
add_action('woo_nav_before', 'artificer_header_cart_link', 20);
if ( ! function_exists( 'artificer_header_cart_link' ) ) {
    function artificer_header_cart_link() {
        if ( class_exists( 'woocommerce' ) ) { echo woocommerce_cart_link(); }
    }
}

// Add the checkout link to the header
add_action('woo_nav_before', 'artificer_header_checkout_link',10);
if ( ! function_exists( 'artificer_header_checkout_link' ) ) {
    function artificer_header_checkout_link() {
        global $woocommerce;
    ?>
    <a href="<?php echo $woocommerce->cart->get_checkout_url()?>" class="checkout">
        <span class="lozenge"><?php _e('Checkout','woothemes') ?></span>
    </a>
<?php }
}

function woocommerce_cart_link() {
    global $woocommerce;
    ?>
    <a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php echo     sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> <?php _e('in your shopping cart', 'woothemes'); ?>" class="cart-button ">
        <span class="label"><?php _e('My Basket:', 'woothemes'); ?></span>
        <?php echo $woocommerce->cart->get_cart_total();  ?>
        <span class="items"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count); ?></span>
    </a>
<?php
}

edit: I realized that actually there is also one more language file which causes the translation of the "2 items" text from my image. These language files are in the artificer theme in the lang folder.

I haven't noticed this before until I used CodeStyling Localisation plugin.

Nevertheless, I haven't been able to translate "My Basket", so I changed it manually in the theme-woocommerce.php file manually.

share|improve this answer

I was able to change it by change the following below:

My Basket - <?php _e('My Basket:', 'woothemes'); ?></span>

Items- title="<?php echo sprintf(_n('%d item', '%d items', $woocommerce->

Checkout- <a href="<?php echo $woocommerce->cart->get_checkout_url()?>" class="checkout"><span class="lozenge"><?php _e('Checkout','woothemes') ?></span></a>

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.