1 回答

TA贡献1804条经验 获得超2个赞
您可以在第一个函数中包含第三个函数,因此您的代码将类似于:
add_filter('woocommerce_default_address_fields', 'customize_default_address_fields', 20, 1 );
function customize_default_address_fields( $address_fields ) {
$address_fields['first_name']['placeholder'] = 'yxz';
$address_fields['last_name']['placeholder'] = 'yxz';
$address_fields['address_1']['placeholder'] = 'yxz';
$address_fields['company']['placeholder'] = 'yxz';
$address_fields['postcode']['placeholder'] = 'yxz';
$address_fields['city']['placeholder'] = 'yxz';
// Reorder billing and shipping "country" fields (on checkout page)
if ( is_checkout() )
$address_fields['country']['priority'] = 80; // Country
return $address_fields;
}
add_filter( "woocommerce_checkout_fields", "customize_other_checkout_fields", 20, 1 );
function customize_other_checkout_fields( $fields ) {
$fields['billing']['billing_phone']['placeholder'] = 'yxz';
$fields['billing']['billing_email']['placeholder'] = 'yxz';
$fields['billing']['billing_email']['class'] = array('form-row-first'); // HERE
$fields['billing']['billing_phone']['class'] = array('form-row-last'); // HERE
unset($fields['order']['order_comments']);
return $fields;
}
代码位于活动子主题(或活动主题)的 function.php 文件中。测试和工作。
- 1 回答
- 0 关注
- 184 浏览
添加回答
举报