Support » Plugin: WooCommerce Cart PDF » Change PDF prefix

  • Hello there 🙂 !

    First of all, thank you for this simple and efficient plugin!

    Right now, the plugin generate the PDF and call it like this “WC_Cart-[year][month][day][bin2hex( openssl_random_pseudo_bytes(5))].pdf”.

    I would like to change this name to something like “[name-of-my-site]-[year][month][day][bin2hex( openssl_random_pseudo_bytes(5))].pdf” without editing the core files of your plugin.

    Thank you in advance,

Viewing 1 replies (of 1 total)
  • Plugin Author David Jensen



    Yes there is a filter you can use to change the name, in your case you can use the following and place it in your child themes functions.php file

     * Change WC Cart PDF filename
     * @return string
    function child_theme_wc_cart_pdf_filename( $filename ) {
        // Do not append .pdf extension
        return 'nameofsite-' . date( 'Ymd' ) . bin2hex( openssl_random_pseudo_bytes( 5 ) );
    add_filter( 'wc_cart_pdf_filename', 'child_theme_wc_cart_pdf_filename' );
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.