1
votes

I am setting up a website based on Wordpress and Woocommerce can you tell me how can I change the Shopping Item in woocommerce. I want the title to be just "Cart".

I've tried to change it with add_action, but without success, even got an error.

add_action('cart-title', 'change-cart-title', 10);
$message = __('Cart', 'woocommerce');
echo '<span class="cart-title">' . $message . '</span>';
}, 9);

How can I change the cart-title to just Cart?

1
There is no change-cart-title hook in WooCommerce official documentation. You can try editing template files.Aftabul Islam
“even got an error” - of course you get an error with that code, because that is not even syntactically correct PHP.04FS
Apart from that, WooCommerce does not output the cart title in its own templates - this is coming from the page you have assigned as the “cart page” in the WC extended settings. So, if you want to change the “title” of the cart - go edit that page.04FS

1 Answers

3
votes

You can use this to change cart page title

function wpa_change_my_basket_text( $translated_text, $text, $domain ){
if($translated_text == 'Cart:' )
    $translated_text = 'Basket:';
return $translated_text;
}
add_filter( 'gettext', 'wpa_change_my_basket_text', 10, 3 );