From 28f9c407005944178261ba8d52f135d101ab1b14 Mon Sep 17 00:00:00 2001 From: Max Rice Date: Fri, 20 Jul 2012 17:19:52 -0400 Subject: [PATCH 1/2] add option to enable / disable coupon form on cart page --- admin/settings/settings-init.php | 11 ++++++++++- templates/cart/cart.php | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/admin/settings/settings-init.php b/admin/settings/settings-init.php index 3789d8fb727..01a224c86ff 100644 --- a/admin/settings/settings-init.php +++ b/admin/settings/settings-init.php @@ -147,7 +147,16 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings', 'checkboxgroup' => 'start', 'show_if_checked' => 'option' ), - + + array( + 'desc' => __( 'Enable coupon form on cart', 'woocommerce' ), + 'id' => 'woocommerce_enable_coupon_form_on_cart', + 'std' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => '', + 'show_if_checked' => 'yes' + ), + array( 'desc' => __( 'Enable coupon form on checkout', 'woocommerce' ), 'id' => 'woocommerce_enable_coupon_form_on_checkout', diff --git a/templates/cart/cart.php b/templates/cart/cart.php index fdd0347323c..1f024dbdcde 100755 --- a/templates/cart/cart.php +++ b/templates/cart/cart.php @@ -106,7 +106,7 @@ global $woocommerce; - +
From 48d4c16353663706642e2f439c77fe689a7a7fb0 Mon Sep 17 00:00:00 2001 From: Max Rice Date: Fri, 20 Jul 2012 18:52:27 -0400 Subject: [PATCH 2/2] add coupon used order note at checkout --- classes/class-wc-checkout.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/class-wc-checkout.php b/classes/class-wc-checkout.php index b9b507f807a..6a78c2ca8c3 100644 --- a/classes/class-wc-checkout.php +++ b/classes/class-wc-checkout.php @@ -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);