Home / Admin / Prevent Discounts on Renewals
Duplicate Snippet

Embed Snippet on Your Site

Prevent Discounts on Renewals

Does not allow a discount code to be applied when an EDD SL is present in the cart

Code Preview
php
<?php
function kfg_check_if_is_renewal( $return, $discount_id ) {
    // Check if the discount code is valid and is not for renewals.
    if ( EDD()->session->get( 'edd_is_renewal' ) ) {
        edd_set_error( 'edd-discount-error', __( 'This discount is not valid with renewals.', 'edd' ) );
        return false;
    }
    return $return;
}
add_filter( 'edd_is_discount_valid', 'kfg_check_if_is_renewal', 99, 2 );

Comments

Add a Comment