I am trying to check if an attribute is set to yes then show this block.
<?php if($_item->getAttributeText('free_shipping_toggle')=='1'): ?>
<?php echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('free-shipping-list-marker')->toHtml();?>
<?php else: ?>
<!--Placeholder for other statement-->
<?php endif; ?>
Best Answer
If it's a boolean (Yes/No) attribute, then you can use:
if ($_item->getData('free_shipping_toggle'))
This will check if attribute exists and if yes what values it is.