Last active
August 29, 2015 14:01
-
-
Save amdrew/ef0f6410db836c8b9e3f to your computer and use it in GitHub Desktop.
Easy Digital Downloads - Change the button text of a free download. Default is "Free - Add to Cart"
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 | |
/** | |
* Easy Digital Downloads | |
* Change the button text of a free download. Default is "Free - Add to Cart" | |
*/ | |
function sumobi_edd_free_download_text_args( $args ) { | |
// Enter the button text for a free download | |
$free_download_text = 'Free download'; | |
$variable_pricing = edd_has_variable_prices( $args['download_id'] ); | |
if ( $args['price'] && $args['price'] !== 'no' && ! $variable_pricing ) { | |
$price = edd_get_download_price( $args['download_id'] ); | |
if ( 0 == $price ) { | |
$args['text'] = $free_download_text; | |
} | |
} | |
return $args; | |
} | |
add_filter( 'edd_purchase_link_args', 'sumobi_edd_free_download_text_args' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment