php 更改Checkout页面上的字段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 更改Checkout页面上的字段相关的知识,希望对你有一定的参考价值。

/*

--- FIELDS ---

# BILLING #

billing_first_name
billing_last_name
billing_company
billing_address_1
billing_address_2
billing_city
billing_postcode
billing_country
billing_state
billing_email
billing_phone

# SHIPPING #

shipping_first_name
shipping_last_name
shipping_company
shipping_address_1
shipping_address_2
shipping_city
shipping_postcode
shipping_country
shipping_state

# ACCOUNT #

account_username
account_password
account_password-2

# OTHERS #

order_comments

--- PROPERTIES ---

type – type of field (text, textarea, password, select)
label – label for the input field
placeholder – placeholder for the input
class – class for the input
required – true or false, whether or not the field is require
clear – true or false, applies a clear fix to the field/label
label_class – class for the label element
options – for select boxes, array of options (key => value pairs)

*/


add_filter( 'woocommerce_checkout_fields' , 'custom_checkout_fields' );

function custom_checkout_fields( $fields ) {

  unset($fields['billing']['billing_company']);
  unset($fields['billing']['billing_postcode']);
  
  $fields['billing']['billing_phone']['placeholder'] = 'Número de móvil preferiblemente';
  
  return $fields;
	
}

以上是关于php 更改Checkout页面上的字段的主要内容,如果未能解决你的问题,请参考以下文章

php 此MU插件允许从Checkout页面删除字段

php WooCommerce:从Checkout页面删除不必要的账单字段。

php WooCommerce:从Checkout页面删除不必要的账单字段。

php 更改“我的帐户”页面上的字段

php 删除WooCommerce Checkout页面上的内联条款和条件

php 删除WooCommerce Checkout页面上的内联条款和条件