0

I am working with the woocommerce artificer theme and there is a place in the header where it says "My Basket" and then the amount that is in your cart. enter image description here
I would like to change the text to say "My Cart". I have looked around. I even found a post on here where the poster shows where the files come from the post can be found here: Change My Basket text in the header of WooCommerce Artificer theme

I went into the theme-woocommerce file that they talk about and changed the text, although it did not change on the page. I went to the function woocommerce_cart_link() and I deleted everything in the function except: <a href="" class="cart-button "> </a> And the stupid My Basket thing still came up. I delete the class="cart-button " and the button disappears. Is there a hook on the class or how can I find the source so I can get this working? I would like to get the "My Basket" text to say "My Cart" and eventually I will try and change that thing to the left that looks like a cardboard box.

Thanks for the help.

0

Technically, woocommerce_cart_link() is added to the site just before the menu by the artificer_header_cart_link() function, which is pluggable, meaning you could change that function to call a function that duplicates woocommere_cart_link() but with the text changed.

However, I think the easiest thing to do is to tap into the gettext filter which kicks in for every translatable string.... and all of Woo's themes are fully translatable.

This will change any "My Basket:" string anywhere in the theme to say "My Cart:"

function wpa_109750_change_text( $translated_text, $text, $domain ){
    if( $domain == 'woothemes' && $translated_text == 'My Basket:' )
        $translated_text = 'My Cart:';

    return $translated_text;
}
add_filter( 'gettext', 'wpa_109750_change_text', 10, 3 );
1
  • You are awesome – tech Nov 8 '13 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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