Remove Agree To Terms For Free Downloads on Easy Digital Downloads

This is useful is you offer some free downloads in your Easy Digital Downloads shop, and you want to remove the Terms, and “Agree To Terms” checkbox, for free downloads.

This first snippet removes the Terms from the checkout page for free downloads.

PHP

/**
 * For free downloads, remove the Terms from checkout page
 */
function isa_free_download_custom_checkout() {
	if ( function_exists('edd_get_cart_total')) {
		if ( edd_get_cart_total() < 0.001 ) {
			// Remove Terms agreement checkbox
			remove_all_actions( 'edd_purchase_form_before_submit' );
			remove_action( 'edd_checkout_form_top', 'edd_agree_to_terms_js' );
		}
	}
}
add_action( 'init', 'isa_free_download_custom_checkout' );

This next snippet will prevent the error from appearing because the customer did not check the Agree to Terms checkbox.

PHP

/**
 * Don't require agree to terms for free downloads
 */
function isa_unset_terms_error( $valid_data, $post_data ) {
	if ( function_exists('edd_get_cart_total')) {
		if ( edd_get_cart_total() < 0.001 ) {
			edd_unset_error( 'agree_to_terms' );
		}
	}
}
add_action( 'edd_checkout_error_checks', 'isa_unset_terms_error', 10, 2 );

 
For offering free downloads in your EDD shop, you may also want to see Remove Credit Card icons on Checkout Page and Bypass Checkout For Free WP Repository Plugins.

See more:

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]