• Resolved Gareth D

    (@garydee1977)


    Hi guys love this plugin!! However lately its not working – getting a critical error when we click the button to create the Cart PDF.

    I’ll copy in the logs relating to it here below – hope you can help!!

    [10-Feb-2025 11:35:24 UTC] PHP Warning:  Undefined variable $cw in /home/SITENAME/public_html/wp-content/plugins/wc-cart-pdf/src/dependencies/Mpdf/Mpdf.php on line 3972
    [10-Feb-2025 11:35:24 UTC] PHP Warning: Undefined variable $glyphIDtoUni in /home/SITENAME/public_html/wp-content/plugins/wc-cart-pdf/src/dependencies/Mpdf/Mpdf.php on line 3989
    [10-Feb-2025 11:35:24 UTC] PHP Warning: Trying to access array offset on null in /home/SITENAME/public_html/wp-content/plugins/wc-cart-pdf/src/dependencies/Mpdf/Otl.php on line 154
    [10-Feb-2025 11:35:24 UTC] PHP Warning: Trying to access array offset on null in /home/SITENAME/public_html/wp-content/plugins/wc-cart-pdf/src/dependencies/Mpdf/Otl.php on line 154

    ---removed few repeats as the support post wouldn't post with the duplicate lines ---

    [10-Feb-2025 11:35:24 UTC] PHP Warning: Trying to access array offset on null in /home/SITENAME/public_html/wp-content/plugins/wc-cart-pdf/src/dependencies/Mpdf/Otl.php on line 162
    [10-Feb-2025 11:35:24 UTC] PHP Warning: file_get_contents(/tmp//mpdf/ttfontdata/dejavusans.GSUBGPOStables.dat): Failed to open stream: No such file or directory in /home/SITENAME/public_html/wp-content/plugins/wc-cart-pdf/src/dependencies/Mpdf/Cache.php on line 72
    [10-Feb-2025 11:35:24 UTC] PHP Fatal error: Uncaught WCCartPDF\Mpdf\MpdfException: Can't open file /tmp//mpdf/ttfontdata/dejavusans.GSUBGPOStables.dat in /home/SITENAME/public_html/wp-content/plugins/wc-cart-pdf/src/dependencies/Mpdf/Otl.php:337
    Stack trace:
    #0 /home/SITENAME/public_html/wp-content/plugins/wc-cart-pdf/src/dependencies/Mpdf/Mpdf.php(13595): WCCartPDF\Mpdf\Otl->applyOTL()
    #1 /home/SITENAME/public_html/wp-content/plugins/wc-cart-pdf/wc-cart-pdf.php(211): WCCartPDF\Mpdf\Mpdf->WriteHTML()
    #2 /home/SITENAME/public_html/wp-includes/class-wp-hook.php(324): wc_cart_pdf_process_download()
    #3 /home/SITENAME/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #4 /home/SITENAME/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
    #5 /home/SITENAME/public_html/wp-includes/template-loader.php(13): do_action()
    #6 /home/SITENAME/public_html/wp-blog-header.php(19): require_once('/home/SITE...')
    #7 /home/SITENAME/public_html/index.php(17): require('/home/SITE...')
    #8 {main}
    thrown in /home/SITENAME/public_html/wp-content/plugins/wc-cart-pdf/src/dependencies/Mpdf/Otl.php on line 337

    • This topic was modified 2 months, 3 weeks ago by Gareth D.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author David Jensen

    (@dkjensen)

    Hello

    I do not have access to a computer for a couple days, but I found a possible solution, could you try adding this constant to your wp-config.php:

    https://github.com/kartik-v/yii2-mpdf/issues/9#issuecomment-320127437

    or the temp directory change in this article

    https://github.com/dkjensen/wc-cart-pdf/wiki/Troubleshooting-images-not-loading

    It seems to be related to the temp directory

    Thread Starter Gareth D

    (@garydee1977)

    Thanks for the prompt response David – unfortunately neither solution seems to work.

    Listen, I’m just back from holidays myself – so if you are on leave, don’t worry about this until you are back. If you want I can give you access etc. Strange one indeed. Nothing on hosting has changed to my knowledge… Could another plugin update cause this?

    If you want to respond when you are back, we can hopefully rectify! Thank you!

    Plugin Author David Jensen

    (@dkjensen)

    Yes I’ll be back in a couple of days, I’ll reach out then, thanks.

    Thread Starter Gareth D

    (@garydee1977)

    Perfect thank you

    Plugin Author David Jensen

    (@dkjensen)

    Hello

    Could you try the following? I noticed in your error log the temp directory has a double slash, this should resolve that, but not sure if that’s the issue:

    add_filter( 'wc_cart_pdf_mpdf_args', function( $args ) {
    $args['tempDir'] = rtrim( get_temp_dir(), '/' );

    return $args;
    } );

    Next, could you confirm that the /tmp directory is writable?

    If that doesn’t work, try this:

    add_filter( 'wc_cart_pdf_mpdf_args', function( $args ) {
    $args['tempDir'] = wp_upload_dir()['basedir'] . '/wc-cart-pdf';

    return $args;
    } );
    Thread Starter Gareth D

    (@garydee1977)

    Morning – apologies! I hadn’t spotted your reply last week!

    Yes just enabled the plugin and added in your custom code there to the functions.php for child theme

    All is working again!! So thank you very much!

    Plugin Author David Jensen

    (@dkjensen)

    Hi @garydee1977

    Could you confirm which of the code snippets worked?

    Thread Starter Gareth D

    (@garydee1977)

    Sorry yes I had put both in – BUT on testing – it was only the 2nd one that I needed and that cured the issue David

    Plugin Author David Jensen

    (@dkjensen)

    Thanks, glad we could get that sorted!

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.