Product % coupons
This commit is contained in:
parent
730b074d6f
commit
65de79799c
|
@ -30,7 +30,7 @@ function woocommerce_coupon_data_meta_box($post) {
|
|||
woocommerce_wp_select( array( 'id' => 'discount_type', 'label' => __('Discount type', 'woothemes'), 'options' => $woocommerce->get_coupon_discount_types() ) );
|
||||
|
||||
// Amount
|
||||
woocommerce_wp_text_input( array( 'id' => 'coupon_amount', 'label' => __('Coupon amount', 'woothemes'), 'placeholder' => __('0.00', 'woothemes'), 'description' => __('Enter an amount e.g. 2.99 or an integer for percentages e.g. 20%', 'woothemes') ) );
|
||||
woocommerce_wp_text_input( array( 'id' => 'coupon_amount', 'label' => __('Coupon amount', 'woothemes'), 'placeholder' => __('0.00', 'woothemes'), 'description' => __('Enter an amount e.g. 2.99', 'woothemes') ) );
|
||||
|
||||
// Individual use
|
||||
woocommerce_wp_checkbox( array( 'id' => 'individual_use', 'label' => __('Individual use', 'woothemes'), 'description' => __('Check this box if the coupon cannot be used in conjunction with other coupons', 'woothemes') ) );
|
||||
|
|
|
@ -400,8 +400,12 @@ class woocommerce_cart {
|
|||
// Product Discounts
|
||||
if ($this->applied_coupons) foreach ($this->applied_coupons as $code) :
|
||||
$coupon = &new woocommerce_coupon( $code );
|
||||
if ($coupon->type=='fixed_product' && (in_array($values['product_id'], $coupon->product_ids) || in_array($values['variation_id'], $coupon->product_ids))) :
|
||||
$this->discount_total = $this->discount_total + ( $coupon->amount * $values['quantity'] );
|
||||
if ((in_array($values['product_id'], $coupon->product_ids) || in_array($values['variation_id'], $coupon->product_ids))) :
|
||||
if ($coupon->type=='fixed_product') :
|
||||
$this->discount_total = $this->discount_total + ( $coupon->amount * $values['quantity'] );
|
||||
elseif ($coupon->type=='percent_product') :
|
||||
$this->discount_total = $this->discount_total + ( $total_item_price / 100 ) * $coupon->amount;
|
||||
endif;
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
|
|
|
@ -225,7 +225,8 @@ class woocommerce {
|
|||
$this->coupon_discount_types = apply_filters('woocommerce_coupon_discount_types', array(
|
||||
'fixed_cart' => __('Cart Discount', 'woothemes'),
|
||||
'percent' => __('Cart % Discount', 'woothemes'),
|
||||
'fixed_product' => __('Product Discount', 'woothemes')
|
||||
'fixed_product' => __('Product Discount', 'woothemes'),
|
||||
'percent_product' => __('Product % Discount', 'woothemes')
|
||||
));
|
||||
endif;
|
||||
return $this->coupon_discount_types;
|
||||
|
|
|
@ -71,6 +71,7 @@ For further documentation on using WooCommerce, please sign up for free at http:
|
|||
* Fixed menu order when logged in as a shop manager
|
||||
* Added SKU column to order data
|
||||
* Removed output buffering from loop
|
||||
* Add proudct % coupons
|
||||
* Lots of other minor fixes
|
||||
|
||||
= 1.1.2 - 23/10/2011 =
|
||||
|
|
Loading…
Reference in New Issue