更改文本woocommerce迷你按钮
On our Staging-Site for ergotopia.de I am trying to change the button text of the dropdown minicart, like you see in picture. To reduce confusing: On ergotopia.de its the right text, but since updates (which we test on our Staging) it was changing the buttons text, and I am unable to change the text.
I tried the following things, without success:
- translations via loco-translate
-
functions.php with following code:
add_filter('gettext', 'translate_text'); add_filter('ngettext', 'translate_text');
function translate_text($translated) { $translated = str_ireplace('Kasse', 'Weiter zur Kasse', $translated); return $translated; }
-
In Child Theme (childtheme\woocommerce\includes\wc-template-functions.php) I edited the file in line 1487:
function woocommerce_widget_shopping_cart_proceed_to_checkout() { echo '<a href="' . esc_url( wc_get_checkout_url() ) . '" class="button checkout wc-forward">' . esc_html__( 'Weiter zur Kasse', 'woocommerce' ) . '</a>'; }
Do you know how to change it?
在我们的临时站点上为ergotopia.de我正在尝试更改下拉式minicart的按钮文本,就像你一样 见图。 为了减少混淆:在ergotopia.de上它是正确的文本,但是由于更新(我们在Staging上测试)它正在更改按钮文本,我无法更改文本。 p>
我尝试了以下操作,但没有成功: strong> p>
functions.php,代码如下: p>
In Child Theme(childtheme \ woocommerce \ includes \ wc-template-functions.php)我在第1487行编辑了文件: p>
你知道怎么改变吗? strong> p>
div>
add_filter('gettext', 'translate_text');
add_filter('ngettext','translate_text'); code> p>
function translate_text($ translated){
$ translated = str_ireplace(' Kasse','Weiter zur Kasse',$翻译);
return $翻译;
} code> p> li>
function woocommerce_widget_shopping_cart_proceed_to_checkout(){
echo' &lt; a href =“'。 esc_url(wc_get_checkout_url())。 '“class =”按钮结帐wc-forward“&gt;' .esc_html __('Weiter zur Kasse','woocommerce')。'&lt; / a&gt;';
} code> p> li>
ol>
SOLUTION: I had to add priority like
add_filter('gettext', 'translate_text',999);
add_filter('ngettext', 'translate_text',999);