I need that when a customer fill _billing_adress in Woocommerce… this value will be the same that _billing_address_2. If is possible with any function?
add_action('woocommerce_payment_complete', 'replicate_billing_adress', 100, 1);
function replicate_billing_adress($order_id){
$order = new WC_Order($order_id); //obatin the completed order as object
$_billing_address_1 = $order->_billing_address_1(); //get the billing email address
update_post_meta($order_id, '_billing_address_1', $_billing_address_2); //update the company email
update_post_meta($order_id, '_billing_address_1', $_billing_address_2); //it maybe saved like that, with underscore, ommit if not needed
}
3
Answers
yes it´s just an example but I don´t know if it will be...
I don´t understand your code.
Check this out