Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Signup fee when a download (recurring) is being renewed #169

Open
mihaijoldis opened this issue Apr 27, 2022 · 0 comments
Open

Remove Signup fee when a download (recurring) is being renewed #169

mihaijoldis opened this issue Apr 27, 2022 · 0 comments

Comments

@mihaijoldis
Copy link
Contributor

Based ona customer's requirement.
If a user purchases a Pass (AA, recurring) they are charged a signup fee. The next time they wish to purchase it they should not be charged the signup fee:

function edd_remove_signup_fee_if_purchased( $item ) {

	if ( ! is_user_logged_in() ) {
		return $item;
	}

	// Change your Membership ID here for which you wish to remove the Signup Fee.
	$excluded_download = 405;

	if ( $excluded_download != $item['id'] ) {
		return $item;
	}

	if ( isset( $item['options']['recurring']['signup_fee'] ) ) {

		if( edd_has_user_purchased( get_current_user_id(), $item['id'] ) ) {
			$item['options']['recurring']['signup_fee'] = 0;
		}
	}

	return $item;
}
add_filter( 'edd_add_to_cart_item', 'edd_remove_signup_fee_if_purchased', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant