Skip to content

Instantly share code, notes, and snippets.

@frankschrijvers
Last active October 24, 2016 02:40
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/699f66bff5b362350a6c080801be9725 to your computer and use it in GitHub Desktop.
Save frankschrijvers/699f66bff5b362350a6c080801be9725 to your computer and use it in GitHub Desktop.
Display field value on the WooCommerce order edition page and emails
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Display field value on the order edition page
add_action( 'woocommerce_admin_order_data_after_billing_address', 'wps_select_checkout_field_display_admin_order_meta', 10, 1 );
function wps_select_checkout_field_display_admin_order_meta($order){
echo '<p><strong>'.__('Delivery option').':</strong> ' . get_post_meta( $order->id, 'daypart', true ) . '</p>';
}
//* Add selection field value to emails
add_filter('woocommerce_email_order_meta_keys', 'wps_select_order_meta_keys');
function wps_select_order_meta_keys( $keys ) {
$keys['Daypart:'] = 'daypart';
return $keys;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment