WooCommerce如何更改“退货”按钮的文字?

j.c*_*j.c 1 hook woocommerce

I can change the button link using the woocommerce_return_to_shop_redirect hook, but i cannot find a "nice" way to change the button text.
I would avoid modifying the core file wp-content/plugins/woocommerce/templates/cart/cart-empty.php every time woocommerce gets updated.

Any other ideas?
Thanx.

小智 5

您可以这样进行。在以下示例中,我将“商店”更改为“商店”。

add_filter('gettext','change_woocommerce_return_to_shop_text',20,3);

函数change_woocommerce_return_to_shop_text($ translated_text,$ text,$ domain){

        开关($ translated_text){

            案例“返回商店”:

                $ translated_text = __('返回商店','woocommerce');
                打破;

        }

    返回$ translated_text;
}