Created
May 13, 2013 21:07
-
-
Save michael-cannon/5571534 to your computer and use it in GitHub Desktop.
Add recurring period to pricing
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 | |
add_filter( 'edd_purchase_download_form', 'aihrus_edd_purchase_download_form', 10, 2 ); | |
function aihrus_edd_purchase_download_form( $purchase_form, $args ) { | |
$id = $args['download_id']; | |
$price = edd_get_download_price( $id ); | |
if ( 0 == $price ) { | |
$price = '$' . $price; | |
$replace = 'Free'; | |
$purchase_form = str_replace( $price, $replace, $purchase_form ); | |
} elseif ( class_exists( 'EDD_Recurring' ) && EDD_Recurring()->is_recurring( $id ) ) { | |
$period = EDD_Recurring()->get_period_single( $id ); | |
if ( 'never' != $period ) { | |
$replace = $price . ' per ' . $period; | |
$purchase_form = str_replace( $price, $replace, $purchase_form ); | |
} | |
} | |
return $purchase_form; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment