Last active
February 15, 2018 14:03
-
-
Save kloon/aaf011ff0b26ea836404 to your computer and use it in GitHub Desktop.
WooCommerce PDF Watermark add custom template tags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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