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; ?>
  • Can you please add more detail which problem are you facing ? – Suresh Chikani Jul 27 '16 at 18:12

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.