Skip to content

Instantly share code, notes, and snippets.

@kloon
Created January 17, 2013 05:46
Show Gist options
  • Save kloon/4553982 to your computer and use it in GitHub Desktop.
Save kloon/4553982 to your computer and use it in GitHub Desktop.
WooCommerce add custom field to invoice
<?php
// add custom field to invoice email
add_action( 'woocommerce_email_after_order_table', 'woocommerce_custom_invoice_fields' );
function woocommerce_custom_invoice_fields( $order ) {
?>
<p><strong><?php _e('Free Book:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Free Book', true ); ?></p>
<p><strong><?php _e('Free DVD:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Free DVD', true ); ?></p>
<p><strong><?php _e('Gift:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Gift Order', true ); ?></p>
<p><strong><?php _e('Gift Message:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Special Gift Message', true ); ?></p>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment