From: Chuck Scott Date: Fri, 24 Jul 2015 18:10:22 +0000 (-0400) Subject: Added custom fields Gift Message and FedEx Shipping to printouts X-Git-Tag: v1.0.8^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=557bffdf0666b1faadfe477b52264187609e3174;p=WP-Themes%2FTomsMomsCookies.git Added custom fields Gift Message and FedEx Shipping to printouts --- diff --git a/functions.php b/functions.php index 4a97868..917912c 100755 --- a/functions.php +++ b/functions.php @@ -192,6 +192,25 @@ function tm_added_checkout_fields_email( $keys ) { return $keys; } +// Add custom fields to order printouts +function add_custom_fields_to_order_printout( $fields, $order ) { + $new_fields = array(); + if( get_post_meta( $order->id, 'Gift Message', true ) ) { + $new_fields['Gift Message'] = array( + 'label' => 'Gift Mesage', + 'value' => get_post_meta( $order->id, 'Gift Message', true ) + ); + } + if( get_post_meta( $order->id, 'FedEx Shipping', true ) ) { + $new_fields['FedEx Shipping'] = array( + 'label' => 'FedEx Shipping', + 'value' => get_post_meta( $order->id, 'FedEx Shipping', true ) + ); + } + return array_merge( $fields, $new_fields ); +} +add_filter( 'wcdn_order_info_fields', 'add_custom_fields_to_order_printout', 10, 2 ); + // Add a $1.00 handling fee to all orders. add_action( 'woocommerce_cart_calculate_fees','endo_handling_fee' ); function endo_handling_fee() {