Last active
October 24, 2016 02:40
-
-
Save frankschrijvers/699f66bff5b362350a6c080801be9725 to your computer and use it in GitHub Desktop.
Display field value on the WooCommerce order edition page and emails
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
<?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