Skip to content

Instantly share code, notes, and snippets.

@wpweb101
Last active March 16, 2016 11:58
Show Gist options
  • Select an option

  • Save wpweb101/ed3040882c95be47d1e5 to your computer and use it in GitHub Desktop.

Select an option

Save wpweb101/ed3040882c95be47d1e5 to your computer and use it in GitHub Desktop.
Add custom shortcode in download PDF
<?php
/**
* Adding Custom shortcode value in PDF voucher
*/
function woo_vou_pdf_template_replace_shortcodes( $voucher_template_html, $orderid, $item_key, $items, $voucodes, $productid ) {
// replace {your_shortcode} with actual value
$voucher_template_html = str_replace( '{your_shortcode}', $your_shortcode_value, $voucher_template_html );
return $voucher_template_html;
}
// Add filter to replace voucher template shortcodes in download pdf
add_filter('woo_vou_pdf_template_inner_html', 'woo_vou_pdf_template_replace_shortcodes', 10, 6 );
?>
@wpweb101
Copy link
Author

wpweb101 commented Dec 4, 2015

Put the code in theme functions.php so you don't loss the changes after updating plugin

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