I'm currently looking for a hook, to add a default billing title to the billing_title
select to the WooCommerce checkout
and change-address
setting at the MyAccount page.
It should be something like Please select salutation
and should be a required field. This field comes from the WooCommerce Germanized plugin and is a required field in Germany. Because of this there is no documentation about this (sadly).
答案 0 :(得分:0)
这是我的解决方案:
/**
* Add billing title default selection value
*/
add_filter( 'woocommerce_gzd_title_options', 'add_new_billing_title', 10, 1 );
function add_new_billing_title( $titles ) {
array_unshift( $titles, 'Bitte auswählen' );
return $titles;
}
我正在使用array_unshift
添加默认的请选择德语值作为选择中的第一个元素。