简体   繁体   中英

Woocommerce Field Label Edit

I am trying to change the form label in Woocommerce from "Billing details" to "Delivery Details" on the cart page

The below has updated this field in the "my-account/addresses" page, however not on the cart page

//Change the Billing Address checkout label
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing Address' :
$translated_text = __( 'Delivery Address', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );

Below code will work definitely .

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

function change_woocommerce_return_to_shop_text ( $translated_text, $text, $domain ) {

    switch ( $translated_text ) {

        case 'Return to shop' :

            $translated_text = __( 'Return to home', 'woocommerce' );
            break;

        case 'Shipping' :

            $translated_text = __( 'Shipping Fee', 'woocommerce' );
            break;

        case 'Ship to a different address?':
            $translated_text = __( 'Pickup Services at a Different Address?', 'woocommerce' );
            break;

        case 'Pay with your credit card.':
            $translated_text = __( 'Pay with your credit / debit card' );
            break;

        case 'Billing details':
            $translated_text = __( 'Wroking' );
            break;


    }

return $translated_text;
}

// Checkout order notes field placeholder text

add_filter('woocommerce_checkout_fields', 'custom_woocommerce_checkout_fields');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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