I am using EDDiMark PDF Watermark and wonder if there any way to hook the quantity in a similar way like this:
function wc_pdf_watermark_extend_template_tags( $parsed_text, $unparsed_text, $order, $product ) {
foreach ($order->get_items() as $item_id => $item ) {
$item_quantity = $item->get_quantity(); // Get the item quantity
}
// Look for {quantity} in text and replace it with the quantity
$parsed_text = str_replace( '{quantity}', $item_quantity, $parsed_text );
return $parsed_text;
}
add_filter( 'woocommerce_pdf_watermark_parse_template_tags', 'wc_pdf_watermark_extend_template_tags', 10, 4);
https://gist.github.com/woogists/a70e25a570b738f2b0e6c4f5ea11cc65