I am about to sell tickets on my webshop, where I would like to attach a PDF. However I would only like to attach the PDF if the order contains the product type virtual products. In this way I make sure that people buying normal product will not receive a PDF. Is this possible?

1 Answer 1


I assume you 'manually' send these PDF files (own/3rd party module).

You could loop through order items before sending the PDF of the order, checking for product type:

$sendPdf = false;
foreach ($order->getAllVisibleItems() as $orderItem) {
    if ($orderItem->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL) {
        $sendPdf = true;

if ($sendPdf) {
    // Send your PDF

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.