Skip to content

Instantly share code, notes, and snippets.

@frankschrijvers
Created June 9, 2016 14:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankschrijvers/8417327862be07f25f7bf1ac920c7930 to your computer and use it in GitHub Desktop.
Save frankschrijvers/8417327862be07f25f7bf1ac920c7930 to your computer and use it in GitHub Desktop.
Update the order meta with the field value
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Update the order meta with field value
add_action('woocommerce_checkout_update_order_meta', 'wps_select_checkout_field_update_order_meta');
function wps_select_checkout_field_update_order_meta( $order_id ) {
if ($_POST['daypart']) update_post_meta( $order_id, 'daypart', esc_attr($_POST['daypart']));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment