【发布时间】:2017-02-16 18:40:18
【问题描述】:
我想将结帐的帐单字段的值预填充到用户在他第一次购买之前的数据库存储值中。
我尝试了以下代码:
add_filter( 'woocommerce_checkout_fields' , function ( $fields ) {
$fields['billing']['billing_first_name']['placeholder'] = 'First Name';
$fields['billing']['billing_first_name']['default'] = wp_get_current_user()->user_firstname;
return $fields;
});
我在other post 中阅读了有关此解决方案的信息。占位符效果很好,但值却不行。
另外,WooCommerce Doc(第 1 课)没有说明数组值“默认”的任何内容
【问题讨论】:
-
你能展示更多你正在使用的代码吗?
-
@helgatheviking 我刚刚更新了帖子
标签: php wordpress woocommerce