Skip to content

Instantly share code, notes, and snippets.

@amdrew
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amdrew/ef0f6410db836c8b9e3f to your computer and use it in GitHub Desktop.
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"
<?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