commit
6666af8de9
|
@ -148,6 +148,15 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
||||||
'show_if_checked' => 'option'
|
'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(
|
array(
|
||||||
'desc' => __( 'Enable coupon form on checkout', 'woocommerce' ),
|
'desc' => __( 'Enable coupon form on checkout', 'woocommerce' ),
|
||||||
'id' => 'woocommerce_enable_coupon_form_on_checkout',
|
'id' => 'woocommerce_enable_coupon_form_on_checkout',
|
||||||
|
|
|
@ -535,7 +535,13 @@ class WC_Checkout {
|
||||||
wp_set_object_terms( $order_id, 'pending', 'shop_order_status' );
|
wp_set_object_terms( $order_id, 'pending', 'shop_order_status' );
|
||||||
|
|
||||||
// Discount code meta
|
// 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
|
// Order is saved
|
||||||
do_action('woocommerce_checkout_order_processed', $order_id, $this->posted);
|
do_action('woocommerce_checkout_order_processed', $order_id, $this->posted);
|
||||||
|
|
|
@ -106,7 +106,7 @@ global $woocommerce;
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="6" class="actions">
|
<td colspan="6" class="actions">
|
||||||
|
|
||||||
<?php if ( get_option( 'woocommerce_enable_coupons' ) == 'yes' ) { ?>
|
<?php if ( get_option( 'woocommerce_enable_coupons' ) == 'yes' && get_option( 'woocommerce_enable_coupon_form_on_cart' ) == 'yes') { ?>
|
||||||
<div class="coupon">
|
<div class="coupon">
|
||||||
|
|
||||||
<label for="coupon_code"><?php _e('Coupon', 'woocommerce'); ?>:</label> <input name="coupon_code" class="input-text" id="coupon_code" value="" /> <input type="submit" class="button" name="apply_coupon" value="<?php _e('Apply Coupon', 'woocommerce'); ?>" />
|
<label for="coupon_code"><?php _e('Coupon', 'woocommerce'); ?>:</label> <input name="coupon_code" class="input-text" id="coupon_code" value="" /> <input type="submit" class="button" name="apply_coupon" value="<?php _e('Apply Coupon', 'woocommerce'); ?>" />
|
||||||
|
|
Loading…
Reference in New Issue