Skip to content

Instantly share code, notes, and snippets.

@jjmontalban
Created May 11, 2021 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjmontalban/8e2c3199739650378d054d8baec1d131 to your computer and use it in GitHub Desktop.
Save jjmontalban/8e2c3199739650378d054d8baec1d131 to your computer and use it in GitHub Desktop.
Add custom Woocommerce metqa fields
<?php
/**
* @snippet Añadir campos a la ficha de cliente ()
* @author https://jjmontalban.github.io/
*/
add_filter( 'woocommerce_customer_meta_fields', 'custom_woocommerce_customer_meta_fields' );
//Añade el campo CIF y teléfono 2 a usuarios
function custom_woocommerce_customer_meta_fields( $fields ) {
$fields['billing']['fields']['billing_phone2'] = array( 'label' => __( 'Teléfono 2', 'woocommerce' ), 'description' => 'Teléfono alternativo');
$fields['billing']['fields']['billing_cif'] = array( 'label' => __( 'CIF/NIF', 'woocommerce' ), 'description' => '');
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment