我正在尝试更改Woocommerce结帐页面字段的顺序,但它不适合我。我尝试了以下代码:
add_filter( 'woocommerce_default_address_fields', 'bbloomer_move_checkout_fields_woo_3' );
function bbloomer_move_checkout_fields_woo_3( $fields ) {
$fields['billing']['billing_email']['priority'] = 3;
return $fields;
}
它改变了一段时间的顺序,然后在几分之一秒后重新排序原始格式的字段。我不知道我做错了什么。
答案 0 :(得分:0)
在您的子主题中,您可以添加此代码
<?php
// order the keys for your custom ordering or delete the ones you don't need
$mybillingfields=array(
"billing_first_name",
"billing_last_name",
"billing_company",
"billing_address_1",
"billing_address_2",
"billing_city",
"billing_state",
"billing_postcode",
"billing_country",
"billing_email",
"billing_phone",
);
foreach ($mybillingfields as $key){
woocommerce_form_field( $key, $checkout->checkout_fields['billing']
[$key], $checkout->get_value( $key ) );
}
?>