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/594a54d9060ee81d8b72c27c51e2c1ea to your computer and use it in GitHub Desktop.
Save woogists/594a54d9060ee81d8b72c27c51e2c1ea to your computer and use it in GitHub Desktop.
[WooCommerce PDF Watermarks] Change password used for protecting PDF downloads
/*
* Snippet to change password used for protecting PDF download
* Code goes in the functions.php file in your theme.
*/
function wc_pdf_watermark_change_pdf_password( $order_id, $product_id ) {
// Use the order number for the password instead of the billing email
$order = wc_get_order( $order_id );
return $order->get_order_number();
}
add_filter( 'woocommerce_pdf_watermark_file_password', 'wc_pdf_watermark_change_pdf_password' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment