Skip to content

Instantly share code, notes, and snippets.

@SirDarcanos
Created December 13, 2017 06:13
Show Gist options
  • Save SirDarcanos/eae71b484a8f667f8309ba219e8bc4c8 to your computer and use it in GitHub Desktop.
Save SirDarcanos/eae71b484a8f667f8309ba219e8bc4c8 to your computer and use it in GitHub Desktop.
<?php
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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment