Prevents logged-in customers from purchasing an item twice.
<?php
/*
 * Plugin Name: Easy Digital Downloads - Prevent Duplicate Purchases
 * Description: Prevents logged-in customers from purchasing an item twice.
 * Author: Easy Digital Downloads
 * Author URI: https://easydigitaldownloads.com/
 * Version: 1.0
 */

function pw_edd_prevent_duplicate_purchase( $valid_data, $posted ) {
	
	$cart_contents = edd_get_cart_contents();
	foreach( $cart_contents as $item ) {
		if( edd_has_user_purchased( get_current_user_id(), $item['id'] ) ) {
			edd_set_error( 'duplicate_item', 'You have already purchased this item so may not purchase it again' );
		}
	}
}
add_action( 'edd_checkout_error_checks', 'pw_edd_prevent_duplicate_purchase', 10, 2 );
To implement this snippet on your site, create a brand new, empty WordPress plugin and paste the above code inside.