Created
January 9, 2025 14:37
-
-
Save xlplugins/ab4344504600905623ec449f550b9703 to your computer and use it in GitHub Desktop.
Save The NIF field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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