Last active
December 10, 2019 23:53
-
-
Save NickGreen/c575cdbebbef6e3b843f70056f352a5a to your computer and use it in GitHub Desktop.
Remove any product coupons from products in the cart, that have a recurring scheme applied to it from All Products for WooCommerce Subscriptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set the product discount amount to zero if it has a recurring scheme | |
add_filter( 'woocommerce_coupon_get_discount_amount', 'zero_discount_for_excluded_products', 12, 5 ); | |
function zero_discount_for_excluded_products( $discount, $discounting_amount, $cart_item, $single, $coupon ){ | |
if ( false != ( $cart_item[ 'wcsatt_data' ][ 'active_subscription_scheme' ] ) ) | |
$discount = 0; | |
return $discount; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment