Plugin Contributor
Ewout
(@pomegranate)
Are you using any filters to change the filename or have you made any other modifications? This appears to be trying to save a file without a filename.
Thread Starter
AnuVi
(@anuvi)
Oh, thanks for the tip! It works if I comment out this filter:
//change pdf-name
add_filter( ‘wpo_wcpdf_filename’, ‘wpo_wcpdf_custom_filename’, 10, 4 );
function wpo_wcpdf_custom_filename( $filename, $template_type, $order_ids, $context ) {
if(get_locale()==”et”){
$invoice_string = _n( ‘invoice’, ‘invoices’, count($order_ids), ‘woocommerce-pdf-invoices-packing-slips’ );
$new_prefix = _n( ‘Arve’, ‘Arved’, count($order_ids), ‘woocommerce-pdf-invoices-packing-slips’ );
$new_filename = str_replace($invoice_string, $new_prefix, $filename);
return $new_filename;
}
}
Plugin Contributor
Ewout
(@pomegranate)
it’s this bit:
if(get_locale()=="et"){
get_locale is not reliable for backend processes (that may run separately from the actual user), I would recommend to simply use a custom translation instead.
If you still want to use the above filter, make sure to take return $new_filename out of the if conditional (put it at the very and of the function instead) so that it returns a filename for all locales.
Ewout