0

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; ?>
1
  • Can you please add more detail which problem are you facing ? Jul 27, 2016 at 18:12

1 Answer 1

0

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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