<?php //only copy if needed //filter documented at: https://docs.woocommerce.com/document/woocommerce-pdf-product-vouchers-developer-documentation/#wc_pdf_product_vouchers_voucher_filename add_filter('wc_pdf_product_vouchers_voucher_filename', 'cs_my_own_filename'); function cs_my_own_filename ($filename) { // This is how the variable is defined: $filename = 'voucher-' . sanitize_file_name( $this->get_voucher_number() ) . '.' . $type; // Note: $type may be defined as string. Default $type = 'pdf'; // Note: Do not use this filter to change the number. There are other filters for that. // Change string 'voucher' in filename to 'Gutschein' $myname = str_replace('voucher', 'Gutschein', $filename); $filename = $myname; return $filename; // Outputs the following Filename: Gutschein[voucher number].pdf }