Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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