0

I want to show 'Free' if the price is 0.00. Could you guys check my code below is it correct?

<?php edd_price($download_id = 0); ?>
if( edd_get_download_price( get_the_ID() ) == 0 ) {
?>Free
Red4x
  • 51
  • 1
  • 4
  • I don't know how the rest of your code looks, but from seeing this part, you are missing the inside of the if clause and an } at the end, before closing the php clause. Also, you have closed the php clause in the first line and then close it again in the third. – Geshode Dec 09 '17 at 03:54

1 Answers1

1

I dont know about EDD but your code has syntax issues:

<?php edd_price($download_id = 0); ?>
if( edd_get_download_price( get_the_ID() ) == 0 ) {
?>Free

Here, if( edd_get_download_price( get_the_ID() ) == 0 ) is not enclosed by <?php tag. You should remove the ?> in the line before. Also, you are missing the closing braces for you if.Not sure if thats because you have more codes that you did not show here.

Update:

As per the comment below, the code should be updated as below:

<?php if( edd_get_download_price( get_the_ID() ) == 0 ) { ?>
    <h5>Free</h5></span>
<?php } ?>
Kamrul Khan
  • 3,260
  • 4
  • 32
  • 59