• Ced

    (@cedriccharles)


    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,
    Cedric

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

    (@dkjensen)

    Hello

    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)
  • The topic ‘Change PDF prefix’ is closed to new replies.