WC_Product::is_downloadable PHP Method

is_downloadable() public method

Checks if a product is downloadable.
public is_downloadable ( ) : boolean
return boolean
    public function is_downloadable()
    {
        return apply_filters('woocommerce_is_downloadable', true === $this->get_downloadable(), $this);
    }

Usage Example

	<tbody>
		<?php 
if (sizeof($order->get_items()) > 0) {
    foreach ($order->get_items() as $item) {
        if (isset($item['variation_id']) && $item['variation_id'] > 0) {
            $_product = new WC_Product_Variation($item['variation_id']);
        } else {
            $_product = new WC_Product($item['id']);
        }
        echo '
					<tr>
						<td class="product-name">';
        echo '<a href="' . get_permalink($item['id']) . '">' . $item['name'] . '</a>';
        $item_meta = new order_item_meta($item['item_meta']);
        $item_meta->display();
        if ($_product->exists && $_product->is_downloadable() && ($order->status == 'completed' || get_option('woocommerce_downloads_grant_access_after_payment') == 'yes' && $order->status == 'processing')) {
            echo '<br/><small><a href="' . $order->get_downloadable_file_url($item['id'], $item['variation_id']) . '">' . __('Download file &rarr;', 'woocommerce') . '</a></small>';
        }
        echo '</td><td class="product-quantity">' . $item['qty'] . '</td><td class="product-total">' . $order->get_formatted_line_subtotal($item) . '</td></tr>';
        // Show any purchase notes
        if ($order->status == 'completed' || $order->status == 'processing') {
            if ($purchase_note = get_post_meta($_product->id, '_purchase_note', true)) {
                echo '<tr class="product-purchase-note"><td colspan="3">' . apply_filters('the_content', $purchase_note) . '</td></tr>';
            }
        }
    }
}
do_action('woocommerce_order_items_table', $order);
?>
	</tbody>
</table>
All Usage Examples Of WC_Product::is_downloadable
WC_Product