I need to add echo $product->get_stock_quantity() in following code to display it in pdf. Can you please help me to insert this $product->get_stock_quantity() into code bellow:
foreach ($order->get_items() as $item_id => $item) {
$product = wc_get_product($item->get_product_id());
$with_tax = $product->get_price_including_tax();
$without_tax = $product->get_price_excluding_tax();
$tax_amount = $with_tax - $without_tax;
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $item->get_product_id() ),'thumbnail' );
$css = ($item->get_quantity() > 1)?'color:red;':'';
?>
<tr><td><?php echo $product->get_sku();?></td><td><img width='60' src="<?php echo $image[0]; ?>"/></td><td style="text-align: center;font-family:DejaVu Sans, sans-serif;font-size:12px;"><?php echo $item->get_name();?></td><td style="text-align: center;"><img width='60' src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=<?php echo $product->get_sku();?>"/></td><td style="text-align: center; <?php echo $css;?>"><?php echo $item->get_quantity();?></td><td><?php echo wc_price( $with_tax );?> </td><td style="text-align: center;font-family:DejaVu Sans, sans-serif;">[]</td></tr>
Not succed to make myself.