Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogists/a70e25a570b738f2b0e6c4f5ea11cc65 to your computer and use it in GitHub Desktop.
Save woogists/a70e25a570b738f2b0e6c4f5ea11cc65 to your computer and use it in GitHub Desktop.
[WooCommerce PDF Watermark] Adding More Tags To Text Watermarks
/*
* Snippet to add more tags to text watermarks.
* Code goes in the functions.php file in your theme.
*/
function wc_pdf_watermark_extend_template_tags( $parsed_text, $unparsed_text, $order, $product ) {
// Look for {product_title} in text and replace it with the product title
$parsed_text = str_replace( '{product_title}', $product->get_title(), $parsed_text );
return $parsed_text;
}
add_filter( 'woocommerce_pdf_watermark_parse_template_tags', 'wc_pdf_watermark_extend_template_tags', 10, 4 );
@jpinostudio128k
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment