Created
July 14, 2015 11:24
-
-
Save brashrebel/b0ee7fcacd2206f1772f to your computer and use it in GitHub Desktop.
Purchase Link Manipulation
This file contains hidden or 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
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