Woocommerce 如何更改结帐字段文本标签的颜色

Woocommerce how to change the color of a checkout field text label

下午好,

可能有人遇到过这样的问题。如何更改结帐中已定义字段的文本。所有字段都引用一个标签。

哪一个?标签的实际 text 或其 color?

对于标签的实际文本,请使用以下 filter 钩子!例如,如果您想更改 billing section 中的 first name label

add_filter('woocommerce_checkout_fields', 'your_custom_checkout_fields', 20);

function your_custom_checkout_fields($fields){

    $fields['billing']['billing_first_name']['label'] = 'testing label 101!';

    # example of other fields
    # $fields['billing']['billing_last_name']['label'] = 'some label!'; 
    # $fields['billing']['billing_country']['label'] = 'some other label!';
    # $fields['billing']['billing_phone']['label'] = 'other label';
    # $fields['billing']['billing_email']['label'] = 'your label';
}

如果要更改其颜色,请使用以下 css 规则:

.woocommerce #billing_first_name_field label {

  color: pink; /* you could replace pink with any color you want!!! */

}