更改“查看购物车"和“结帐"购物车小部件 Woocommerce 中的按钮文本 [英] Change "View Cart" and "Checkout" buttons text in Cart Widget Woocommerce

查看:40
本文介绍了更改“查看购物车"和“结帐"购物车小部件 Woocommerce 中的按钮文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到正确的函数或过滤器来编辑 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.

我的网站网址:http://modularwave.com/(只是为了让您知道我正在使用 Brutal,zigzagpress 很棒的主题).

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

预先感谢您的帮助,F.

Thanks in advance for you help, F.

推荐答案

你可以使用 str_ireplace() 来改变按钮的文本,下面的函数将允许你改变一个按钮的文本Woocommerce 按钮:

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

这篇关于更改“查看购物车"和“结帐"购物车小部件 Woocommerce 中的按钮文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆