add coupon used order note at checkout

This commit is contained in:
Max Rice 2012-07-20 18:52:27 -04:00
parent 28f9c40700
commit 48d4c16353
1 changed files with 7 additions and 1 deletions

View File

@ -535,7 +535,13 @@ class WC_Checkout {
wp_set_object_terms( $order_id, 'pending', 'shop_order_status' );
// Discount code meta
if ($applied_coupons = $woocommerce->cart->get_applied_coupons()) update_post_meta($order_id, 'coupons', implode(', ', $applied_coupons));
if ( $applied_coupons = $woocommerce->cart->get_applied_coupons() ) {
update_post_meta( $order_id, 'coupons', implode(', ', $applied_coupons) );
$order = new WC_Order( $order_id );
$order->add_order_note( sprintf( __( 'Coupon Code Used: %s', 'woocommerce' ), implode(', ', $applied_coupons ) ) );
}
// Order is saved
do_action('woocommerce_checkout_order_processed', $order_id, $this->posted);