Tweak content. Closes #2311
This commit is contained in:
parent
1cded83298
commit
fb67343611
|
@ -57,7 +57,7 @@ function woocommerce_coupon_data_meta_box( $post ) {
|
||||||
woocommerce_wp_checkbox( array( 'id' => 'apply_before_tax', 'label' => __( 'Apply before tax', 'woocommerce' ), 'description' => __( 'Check this box if the coupon should be applied before calculating cart tax.', 'woocommerce' ) ) );
|
woocommerce_wp_checkbox( array( 'id' => 'apply_before_tax', 'label' => __( 'Apply before tax', 'woocommerce' ), 'description' => __( 'Check this box if the coupon should be applied before calculating cart tax.', 'woocommerce' ) ) );
|
||||||
|
|
||||||
// Exclude Sale Products
|
// Exclude Sale Products
|
||||||
woocommerce_wp_checkbox( array( 'id' => 'exclude_sale_items', 'label' => __( 'Exclude sale item', 'woocommerce' ), 'description' => __( 'Check this box if the coupon should not apply to sale items. Be sure when ticking this box for cart coupons as the presence of any sale item in the cart will stop the coupon from applying', 'woocommerce' ) ) );
|
woocommerce_wp_checkbox( array( 'id' => 'exclude_sale_items', 'label' => __( 'Exclude sale items', 'woocommerce' ), 'description' => __( 'Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are no sale items in the cart.', 'woocommerce' ) ) );
|
||||||
|
|
||||||
echo '</div><div class="options_group">';
|
echo '</div><div class="options_group">';
|
||||||
|
|
||||||
|
|
|
@ -1106,7 +1106,7 @@ class WC_Cart {
|
||||||
* @param mixed $price
|
* @param mixed $price
|
||||||
*/
|
*/
|
||||||
public function apply_product_discounts_after_tax( $values, $price ) {
|
public function apply_product_discounts_after_tax( $values, $price ) {
|
||||||
|
|
||||||
if ( ! empty( $this->applied_coupons) ) {
|
if ( ! empty( $this->applied_coupons) ) {
|
||||||
foreach ( $this->applied_coupons as $code ) {
|
foreach ( $this->applied_coupons as $code ) {
|
||||||
$coupon = new WC_Coupon( $code );
|
$coupon = new WC_Coupon( $code );
|
||||||
|
@ -1154,9 +1154,9 @@ class WC_Cart {
|
||||||
$this_item_is_discounted = false;
|
$this_item_is_discounted = false;
|
||||||
|
|
||||||
// Sale Items excluded from discount
|
// Sale Items excluded from discount
|
||||||
if ( $coupon->exclude_sale_items == 'yes' )
|
if ( $coupon->exclude_sale_items == 'yes' )
|
||||||
if ( in_array( $values['product_id'], $product_ids_on_sale, true ) || in_array( $values['variation_id'], $product_ids_on_sale, true ) || in_array( $values['data']->get_parent(), $product_ids_on_sale, true ) )
|
if ( in_array( $values['product_id'], $product_ids_on_sale, true ) || in_array( $values['variation_id'], $product_ids_on_sale, true ) || in_array( $values['data']->get_parent(), $product_ids_on_sale, true ) )
|
||||||
$this_item_is_discounted = false;
|
$this_item_is_discounted = false;
|
||||||
|
|
||||||
// Apply filter
|
// Apply filter
|
||||||
$this_item_is_discounted = apply_filters( 'woocommerce_item_is_discounted', $this_item_is_discounted, $values, $before_tax = false, $coupon );
|
$this_item_is_discounted = apply_filters( 'woocommerce_item_is_discounted', $this_item_is_discounted, $values, $before_tax = false, $coupon );
|
||||||
|
|
|
@ -178,7 +178,9 @@ class WC_Coupon {
|
||||||
public function enable_free_shipping() {
|
public function enable_free_shipping() {
|
||||||
return $this->free_shipping == 'yes' ? true : false;
|
return $this->free_shipping == 'yes' ? true : false;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
|
|
||||||
|
/**
|
||||||
* Check if a coupon excludes sale items.
|
* Check if a coupon excludes sale items.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -329,7 +331,7 @@ class WC_Coupon {
|
||||||
}
|
}
|
||||||
if ( ! $valid_for_cart ) {
|
if ( ! $valid_for_cart ) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$error = __( 'Sorry, this coupon is not applicable if your cart contains sale items.', 'woocommerce' );
|
$error = __( 'Sorry, this coupon is not valid for sale items.', 'woocommerce' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
||||||
* Feature - Added set_stock() method to product class.
|
* Feature - Added set_stock() method to product class.
|
||||||
* Feature - Linking to mydomain.com/product#review_form will now open the review form on load (if WooCommerce lightbox is turned on)
|
* Feature - Linking to mydomain.com/product#review_form will now open the review form on load (if WooCommerce lightbox is turned on)
|
||||||
* Feature - Customers can sort by popularity + rating.
|
* Feature - Customers can sort by popularity + rating.
|
||||||
|
* Feature - Option to exclude coupons from sale items (thanks aj-adl)
|
||||||
* Templating - Revised pagination, sorting areas (sorting is now above products, numbered pagination below) and added a result count.
|
* Templating - Revised pagination, sorting areas (sorting is now above products, numbered pagination below) and added a result count.
|
||||||
* Templating - email-order-items.php change get_downloadable_file_url() to get_downloadable_file_urls() to support multiple files.
|
* Templating - email-order-items.php change get_downloadable_file_url() to get_downloadable_file_urls() to support multiple files.
|
||||||
* Templating - loop-end and start for product loops, allow changing the UL's used by default to something else.
|
* Templating - loop-end and start for product loops, allow changing the UL's used by default to something else.
|
||||||
|
|
Loading…
Reference in New Issue