0

how to check that product has a custom options or not in magento?

Mage::setIsDeveloperMode(true);         
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$product    = Mage::getModel('catalog/product')->load($sku, 'sku');
$code = $product->getAttribute()->getAttributeCode();
Mihai Stancu
  • 15,848
  • 2
  • 33
  • 51
harshad
  • 1
  • 1

1 Answers1

2
$product    = Mage::getModel('catalog/product')->load($sku, 'sku');
$hasOptions = $product->hasCustomOptions();

Simple as that. At the end $hasOptions should be true or false.

Marius
  • 15,148
  • 9
  • 56
  • 76
  • 1
    There is an error in Magento where `hasOptions` or `hasCustomOptions` will (sometimes) return `false` every time. Refer to this question: http://stackoverflow.com/a/30832285/1330505 – Jongosi Apr 13 '16 at 11:24