Skip to content

Instantly share code, notes, and snippets.

@Creativenauts
Created April 2, 2016 05:02
Show Gist options
  • Save Creativenauts/dcf00751531fd0286eb8eccbaa8a3c68 to your computer and use it in GitHub Desktop.
Save Creativenauts/dcf00751531fd0286eb8eccbaa8a3c68 to your computer and use it in GitHub Desktop.
Easy Digital Downloads - Change Price To Free When Price = $0.00
function get_download_price() {
$price = edd_get_download_price(get_the_ID());
if ( $price == "0.00" ) {
echo 'Free';
} else {
echo '$'.$price;
}
}
@Creativenauts
Copy link
Author

This is a custom function I created to display the price as "free" for downloads that price is $0.00.

You should place this in your themes function.php file.

Calling the function in your theme:

<?php get_download_price() ?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment