Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created January 9, 2025 14:37
Show Gist options
  • Save xlplugins/ab4344504600905623ec449f550b9703 to your computer and use it in GitHub Desktop.
Save xlplugins/ab4344504600905623ec449f550b9703 to your computer and use it in GitHub Desktop.
Save The NIF field
add_action('woocommerce_checkout_create_order',function ($order){
/**
* @var $order WC_Order
*/
if(isset($_POST['billing_nif'])){
$order->add_meta_data('billing_nif', $_POST['billing_nif']);
}
if(isset($_POST['shipping_nif'])){
$order->add_meta_data('shipping_nif', $_POST['shipping_nif']);
}
if(isset($_POST['shipping_vat_number'])){
$order->add_meta_data('shipping_vat_number', $_POST['shipping_vat_number']);
}
if(isset($_POST['billing_vat_number'])){
$order->add_meta_data('billing_vat_number', $_POST['billing_vat_number']);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment