Loại bỏ trường trong trang thanh toán WooCommerce

LMT

Hot Face
Moderator
Bài viết
49
Cảm xúc
4
Xu
18,900
Chèn code vào file function.php
Thêm đoạn code sau vào file function.php
Mã:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
     unset($fields['billing']['billing_state']);
     return $fields;
}
Muốn xóa trường thông tin nào thì bạn copy thêm 1 dòng: unset($fields['billing']['billing_state']); và thay đổi giá trị billing_state thành cái trường theo dưới đây:
Mục Thanh toán (Billing): billing
  • Họ ( First Name): billing_first_name
  • Tên (Last Name): billing_last_name
  • Tên công ty (Company Name): billing_company
  • Địa chỉ (Address): billing_address_1
  • Địa chỉ 2: billing_address_2
  • Tỉnh/Thành phố (Town/City): billing_city
  • Mã bưu điện (Postcode): billing_postcode
  • Quốc gia (Country): billing_country
  • Bang/Hạt (State): billing_state
  • Địa chỉ email (Email Address): billing_email
  • Số điện thoại (Phone): billing_phone
Mục Vận chuyển (Shipping): shipping
  • Họ ( First Name): billing_first_name
  • Tên (Last Name): billing_last_name
  • Tên công ty (Company Name): billing_company
  • Địa chỉ (Address): billing_address_1
  • Địa chỉ 2: billing_address_2
  • Tỉnh/Thành phố (Town/City): billing_city
  • Mã bưu điện (Postcode): billing_postcode
  • Quốc gia (Country): billing_country
  • Bang/Hạt (State): billing_state
Mục Thêm thông tin ghi chú (Additional Infomation): order

  • Ô thêm ghi chú: order_comments
 

LMT

Hot Face
Moderator
Bài viết
49
Cảm xúc
4
Xu
18,900
Mã:
/*
* Remove field payment
*/
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
     unset($fields['billing']['billing_state']);
     unset($fields['billing']['billing_postcode']);
     unset($fields['billing']['billing_company']);
     unset($fields['billing']['billing_address_2']);
     unset($fields['billing']['billing_last_name']);


     return $fields;
}


/*
* Remove field payment
*/
 
Top