0

I want to add two custom blocks on product page - one to be displayed if product is in stock and the other one if product is out of stock.

1 Answer 1

0

on app/design/frontend/yourpackage/YourTheme/catalog/product/view.phtml

file add below code

if($_product->isInStock()){
     echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml(); 
}else{
     echo  $this->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml(); 
}
1
  • @Anna if my answer is solved your requirement then mark as accepted, so other user who has same problem can take benefit from this answer Commented Aug 16, 2017 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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