Change My Basket text in the header of WooCommerce Artificer theme

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="https://wordpress.stackexchange.com/questions/109750/<?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.

Leave a Comment