Last active
August 29, 2015 14:05
-
-
Save SeanTOSCD/8fd7eea76174168c53e7 to your computer and use it in GitHub Desktop.
EDD Required Address Fields But Not on Free Downloads
This file contains 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 | |
/** | |
* Mark address field required except for free downloads | |
*/ | |
function pw_edd_purchase_form_required_fields( $required_fields ) { | |
$cart_total = edd_get_cart_total(); | |
$required_fields['card_address'] = array( | |
'error_id' => 'invalid_adress', | |
'error_message' => __( 'Please enter your address.', 'edd' ) | |
); | |
return 0 != $cart_total ? $required_fields : array(); | |
} | |
add_filter( 'edd_purchase_form_required_fields', 'pw_edd_purchase_form_required_fields' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment