Fantin B
Fantin B

Reputation: 23

Change "View Cart" and "Checkout" buttons text in Cart Widget Woocommerce

I'm trying to find the correct function or filter to edit the text of the buttons "View Cart" and "Checkout" in the Cart Widget of Woocommerce.

My website url : http://modularwave.com/ (just so you know i'm using Brutal, great theme from zigzagpress).

Upvotes: 2

Views: 16023

Answers (2)

Michael Vermeulen
Michael Vermeulen

Reputation: 187

To easily translate plugins use this plugin:

https://wordpress.org/plugins/loco-translate/

It lets you select a plugin.

Note, only plugins with .mo/.po files can be translated.

Upvotes: 1

Daniel_ZA
Daniel_ZA

Reputation: 574

You can use str_ireplace() to change the text of the button, the following function will allow you to change the text of a Woocommerce button:

//The filters.. both are required.
add_filter('gettext', 'change_checkout_btn');
add_filter('ngettext', 'change_checkout_btn');

//function
function change_checkout_btn($checkout_btn){
  $checkout_btn= str_ireplace('Checkout', 'Your New Text', $checkout_btn);
  return $checkout_btn;
}

Upvotes: 4

Related Questions