How to change text of shipping address and billing

2019-05-03 12:22发布

I am using woocommerce for create shop in wordpress. i had change text of billing details to shipping details and vice versa through following code

function wc_custom_addresses_labels( $translated_text, $text, $domain )
{
    switch ( $translated_text )
    {
        case 'Billing Address' : /* Front-end */
            $translated_text = __( 'Shipping Address', 'woocommerce' );
            break;

        case 'Billing Details' : // Back-end 
            $translated_text = __( 'Shipping Detail', 'woocommerce' );
            break;

        case 'Ship to a different address?' : 
            $translated_text = __( 'Bill to a different address?', 'woocommerce' );
            break;

        case 'Shipping Details' : // Back-end 
            $translated_text = __( 'Billing Detail', 'woocommerce' );
            break;
    }
    return $translated_text;
}
add_filter( 'gettext', 'wc_custom_addresses_labels', 20, 3 );

But after this on order recieved page

Billing detail and shipping details had same text and that is shipping address you can check here - http://screencast.com/t/BKOYuAg48W

1条回答
小情绪 Triste *
2楼-- · 2019-05-03 12:45

You can change display according to your need from your theme.

See woocommerce template structure...

Follow instructions in links.

Find order/order-details.php file and edit this file via your theme...

This will make easy to overwrite woo-commerce code and display...

查看更多
登录 后发表回答