1,3K
Thêm đoạn code sau vào trong function.php của themes đang dùng.
add_filter( 'woocommerce_checkout_fields',array($this, 'change_fields') );
function change_fields($fields){
//remove fields
unset($fields['billing']['billing_first_name']);
unset($fields['shipping']['shipping_first_name']);
unset($fields['billing']['billing_address_2']);
unset($fields['shipping']['shipping_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['shipping']['shipping_city']);
unset($fields['billing']['billing_country']);
unset($fields['shipping']['shipping_country']);
unset($fields['billing']['billing_state']);
unset($fields['shipping']['shipping_state']);
unset($fields['billing']['billing_postcode']);
unset($fields['shipping']['shipping_postcode']);
unset($fields['billing']['billing_company']);
unset($fields['shipping']['shipping_company']);
//rename label
$fields['billing']['billing_last_name'] = array(
'label' => __('Họ & Tên ', 'woocommerce'),
'required'=>true
);
$fields['billing']['billing_email'] = array(
'label' => __('Địa chỉ email ', 'woocommerce'),
'required'=>true
);
$fields['billing']['billing_phone'] = array(
'label' => __('Số điện thoại ', 'woocommerce'),
'required'=>true
);
$fields['billing']['billing_address_1'] = array(
'label' => __('Địa chỉ ', 'woocommerce'),
'required'=>true
);
$fields['shipping']['shipping_last_name'] = array(
'label' => __('Họ & Tên ', 'woocommerce'),
'required'=>false
);
$fields['shipping']['shipping_address_1'] = array(
'label' => __('Địa chỉ ', 'woocommerce'),
'required'=>false
);
return $fields;
}