Woocommerce字段标签编辑

时间:2017-06-27 19:18:13

标签: php wordpress plugins woocommerce cart

我正在尝试将Woocommerce中的表单标签从“结算明细”更改为购物车页面上的“投放详情”

以下内容已在“我的帐户/地址”页面中更新此字段,但不在购物车页面上

//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 );

1 个答案:

答案 0 :(得分:1)

代码下方肯定

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');