更改文本woocommerce迷你按钮

更改文本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.

enter image description here

I tried the following things, without success:

  1. translations via loco-translate
  2. 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; }

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

“在此输入图像说明” p>

我尝试了以下操作,但没有成功: strong> p>

  1. 翻译通过loco-translate li>
  2. functions.php,代码如下: p>

    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>

  3. In Child Theme(childtheme \ woocommerce \ includes \ wc-template-functions.php)我在第1487行编辑了文件: p>

    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>

    你知道怎么改变吗? strong> p> div>

SOLUTION: I had to add priority like

add_filter('gettext', 'translate_text',999);
add_filter('ngettext', 'translate_text',999);