I am trying to use an if/else statement within an HTML structure of a return in a PHP function:
function price_vat() {
global $product;
$condition = $product->get_attribute( 'pa_condition' );
return'
<div class="condition-container">
<div class="condition-wrapper">
<?php if($condition = "New"){ ?>
<div id="content-banned">New</div>
<?php } else { ?>
<div id="content-not-banned">Used</div>
<?php } ?>
</div>
</div>
';
}
I am sure it is just a syntax issue here, does anyone have any ideas? Also tried with a tertiary operator but couldn’t get it to work. Any input is appreciated.