Skip to content

Instantly share code, notes, and snippets.

@kloon
Last active February 15, 2018 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kloon/aaf011ff0b26ea836404 to your computer and use it in GitHub Desktop.
Save kloon/aaf011ff0b26ea836404 to your computer and use it in GitHub Desktop.
WooCommerce PDF Watermark add custom template tags
<?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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment