Skip to content

Instantly share code, notes, and snippets.

@bhavik-kiri
Last active December 1, 2017 13:03
Show Gist options
  • Save bhavik-kiri/5f146b905c009e2088aed7573f7568bd to your computer and use it in GitHub Desktop.
Save bhavik-kiri/5f146b905c009e2088aed7573f7568bd to your computer and use it in GitHub Desktop.
<?php
add_action( 'woocommerce_checkout_update_order_meta', 'add_order_delivery_date_to_order' , 10, 1);
function add_order_delivery_date_to_order ( $order_id ) {
if ( isset( $_POST ['add_delivery_date'] ) && '' != $_POST ['add_delivery_date'] ) {
add_post_meta( $order_id, '_delivery_date', sanitize_text_field( $_POST ['add_delivery_date'] ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment