Change “View Cart” and “Checkout” buttons text in Cart Widget Woocommerce

允我心安 提交于 2021-02-05 06:35:07

问题


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).

Thanks in advance for you help, F.


回答1:


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;
}



回答2:


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.

I hope this will help you!

Good luck.



来源:https://stackoverflow.com/questions/34277313/change-view-cart-and-checkout-buttons-text-in-cart-widget-woocommerce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!