简体   繁体   English

Woocommerce-更改2 Checkout标签文本不起作用

[英]Woocommerce - Changing 2 Checkout label text does not work

In the checkout page of Woocommerce, I've tried to change the labels of "Billing details" and "Ship to a different address?" 在Woocommerce的结帐页面上,我试图更改“账单明细”和“运送到其他地址?”的标签。 into other text but when I input 2 similar codes as below, it only changes once: the "Billing details" did change into "Your billing info" but the "Ship to different address" did not. 改为其他文字,但是当我输入以下2个类似的代码时,它只更改了一次:“帐单详细信息”确实更改为“您的帐单信息”,但“运送至其他地址”却没有。 Please help. 请帮忙。

//Change the Billing Address checkout label
function wc_billing_field_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'Billing details' :
            $translated_text = __( 'Your billing info', 'woocommerce' );
            break;
    }
    return $translated_text;
}

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

function shipchange( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'Ship to a different address?' :
            $translated_text = __( 'other shipping address?', 'woocommerce' );
            break;
    }
    return $translated_text;
}

Any methods on how to change all labels' text in Cart and Checkout pages Woocommerce? 有什么方法可以更改Woocommerce和Checkout页面中所有标签的文本?

Try this code. 试试这个代码。

function wc_billing_field_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'Billing details' :
            $translated_text = __( 'Your billing info', 'woocommerce' );
            break;
        case 'Ship to a different address?' :
            $translated_text = __( 'other shipping address?', 'woocommerce' );
            break;
    }
    return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM