Added ability to show order meta in emails - shows coupons by default. Closes #96.

This commit is contained in:
Mike Jolley 2011-11-01 14:12:18 +00:00
parent 42732b7a01
commit 7891105ce1
6 changed files with 42 additions and 20 deletions

View File

@ -83,20 +83,21 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
== Changelog ==
= 1.1.4 - xx/10/2011 =
* Added quick status change buttons (processing/complete) to orders panel
* Ability to preview email templates
* Option to add logout link to my account menu
* Added ability to show meta (custom fields) on order emails - useful for plugins
* Added order details to thankyou page
* Added basic rss feeds for products and product categories
* Added functions which show tax/vat conditionally
* Made use of transients to store average ratings and improve performance
* Edit category - image fix
* Order Complete email heading fix
* 100% discount when price excludes tax logic fix
* Download urls use site_url instead of home_url so installs in subdirectories are handled correctly
* Option to add logout link to my account menu
* Ability to preview email templates
* Added order details to thankyou page
* Added basic rss feeds for products and product categories
* Added functions which show tax/vat conditionally
* Fixed variations - Incorrectly used instead $product_custom_fields of $parent_custom_fields
* Made use of transients to store average ratings and improve performance
* Adding cart item resets shipping - so free shipping etc is selected when going over a threshold
* Changes to shipping calc - if no rates are found, but the user did not enter a state/postcode, it asks them to do so.
* Added quick status change buttons (processing/complete) to orders panel
* Fix for adding sites in multisite
* Dashboard chart now ignores 'pending' orders
* Fixed dashboard report range

View File

@ -41,9 +41,7 @@
</tbody>
</table>
<?php if ($order->customer_note) : ?>
<p><strong><?php _e('Note:', 'woothemes'); ?></strong> <?php echo $order->customer_note; ?></p>
<?php endif; ?>
<?php do_action('woocommerce_email_after_order_table', $order, false); ?>
<h2><?php _e('Customer details', 'woothemes'); ?></h2>

View File

@ -41,8 +41,6 @@
</tbody>
</table>
<?php if ($order->customer_note) : ?>
<p><strong><?php _e('Note:', 'woothemes'); ?></strong> <?php echo $order->customer_note; ?></p>
<?php endif; ?>
<?php do_action('woocommerce_email_after_order_table', $order, false); ?>
<?php do_action('woocommerce_email_footer'); ?>

View File

@ -41,9 +41,7 @@
</tbody>
</table>
<?php if ($order->customer_note) : ?>
<p><strong><?php _e('Note:', 'woothemes'); ?></strong> <?php echo $order->customer_note; ?></p>
<?php endif; ?>
<?php do_action('woocommerce_email_after_order_table', $order, false); ?>
<h2><?php _e('Customer details', 'woothemes'); ?></h2>

View File

@ -41,9 +41,7 @@
</tbody>
</table>
<?php if ($order->customer_note) : ?>
<p><strong><?php _e('Note:', 'woothemes'); ?></strong> <?php echo $order->customer_note; ?></p>
<?php endif; ?>
<?php do_action('woocommerce_email_after_order_table', $order, true); ?>
<h2><?php _e('Customer details', 'woothemes'); ?></h2>

View File

@ -276,4 +276,33 @@ Gothica minim lectores demonstraverunt ut soluta. Sequitur quam exerci veniam al
exit;
endif;
}
}
/**
* Add order meta to email templates
**/
add_action('woocommerce_email_after_order_table', 'woocommerce_email_order_meta', 10, 2);
function woocommerce_email_order_meta( $order, $sent_to_admin ) {
$meta = array();
$show_fields = apply_filters('woocommerce_email_order_meta_keys', array('coupons'), $sent_to_admin);
if ($order->customer_note) :
$meta[__('Note:', 'woothemes')] = wptexturize($order->customer_note);
endif;
if ($show_fields) foreach ($show_fields as $field) :
$value = get_post_meta( $order->id, $field, true );
if ($value) $meta[ucwords(esc_attr($field))] = wptexturize($value);
endforeach;
if (sizeof($meta)>0) :
echo '<h2>'.__('Order information', 'woothemes').'</h2>';
foreach ($meta as $key=>$value) :
echo '<p><strong>'.$key.':</strong> '.$value.'</p>';
endforeach;
endif;
}