-
-
Save woogists/a70e25a570b738f2b0e6c4f5ea11cc65 to your computer and use it in GitHub Desktop.
...and the quantity ordered.
For quantity ordered, you can put this in your functions.php:
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);
Then, use the {quantity}
tag within your watermark body.
Hi, this is working generally but doesn't seem to return the value per line item in an order with more than one PDF. So the last item in the order gets printed on each PDF. Is there a simple update to this to make sure it pulls the data from each line and applies it to that particular PDF? Thanks!
Hello!
I would like to know if there is the possibility to add the DNI/NIF/CIF field that is added by Art Project Group plugin "WC - APG Campo NIF/CIF/NIE".
This field appears in the invoices and is saved in the customer information, but I don't know with what label I could call it or what code I could add to make it appear in the watermark.
...and the quantity ordered.