• Hi there!
    in Italy it’s mandatory to indicate the tax code or VAT in the checkout. how can I insert the field in a way that also appears in the summary of the data in billing and administration? I know it’s a problem with the plugin but since it is a modification useful for all users of e-commerce theme, I ask you. with difficulty I found some changes, but not complete carry the code below (I can not bring up the field in welcome page, the data displayed, in the administration on the invoice) This code is to be past in woocommerce-functions.php

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    // Hook in nel checkout
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    
    function custom_override_checkout_fields( $fields ) {
    // NOTA shipping: appare nella colonna dx - billing appare sotto la colonna sx di fatturazione
    $fields['billing']['piva'] = array(
    'label' => __('Codice Fiscale/P.IVA', 'woocommerce'),
    'placeholder' => _x('Digita il tuo Cod fiscale o partita iva', 'placeholder', 'woocommerce'),//placeholder del campo input
    'required' => false, // cambia in true se obbligatorio
    'class' => array('form-row-wide'), //specifica una classe se vuoi
    'clear' => true
    );
    return $fields;
    }
    
    //Hook Admin
    add_action('woocommerce_checkout_process', 'piva_checkout_field_process');
    
    function piva_checkout_field_process() {
    global $woocommerce;
    // Verifica se è presente quando cliccano su acquista
    if (!$_POST['piva'])
    $woocommerce->add_error( __('Digita la partita iva o codice fiscale per la fattura.') );
    }
    
    //Aggiorna dati
    add_action('woocommerce_checkout_update_order_meta', 'piva_checkout_field_update_order_meta');
    
    function piva_checkout_field_update_order_meta( $order_id ) {
    if ($_POST['piva']) update_post_meta( $order_id, 'Partita IVA / Codice Fiscale', esc_attr($_POST['piva']));
    }

    http://wordpress.org/extend/plugins/woocommerce/

Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Italian problem add field tax or fiscal code’ is closed to new replies.