Skip to content

Instantly share code, notes, and snippets.

@brashrebel
Created July 14, 2015 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brashrebel/b0ee7fcacd2206f1772f to your computer and use it in GitHub Desktop.
Save brashrebel/b0ee7fcacd2206f1772f to your computer and use it in GitHub Desktop.
Purchase Link Manipulation
add_action( 'edd_format_amount_decimals', 'kjm_format_decimals' );
function kjm_format_decimals() {
return 0;
}
add_filter( 'edd_purchase_link_args', 'kjm_adjust_purchase_link_text' );
function kjm_adjust_purchase_link_text( $args ) {
$download = new EDD_Download( $args['download_id'] );
$option = edd_get_option( 'add_to_cart_text' );
$price = edd_currency_filter( edd_format_amount( $download->price ) );
if ( ! $download->is_free( $args['price_id'] ) && ! $download->has_variable_prices() ) {
$args['text'] = $option . ' for ' . $price;
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment