Skip to content

Commit b18f58e

Browse files
committed
Refill PDFs when resetting order PDFs when order has downloadable files
1 parent 21741e0 commit b18f58e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pdf-forms-for-woocommerce.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ public function wp_ajax_reset_order_pdfs()
973973
// remove downloadable files
974974
$this->unset_downloadable_files( $order );
975975

976-
// refilling is necessary only if PDFs are being saved in wp-uploads
976+
// refilling is necessary only if PDFs are being saved in wp-uploads or there are downloadable files
977977
$product_settings = $this->get_order_metadata( $order, 'product-settings' );
978978
if( is_array( $product_settings ) && ! empty( $product_settings ) )
979979
{
@@ -1004,8 +1004,8 @@ public function wp_ajax_reset_order_pdfs()
10041004
{
10051005
if( isset( $attachment['options'] )
10061006
&& is_array( $options = $attachment['options'] )
1007-
&& isset( $options['save_directory'] )
1008-
&& $options['save_directory'] !== "" )
1007+
&& ( ( isset( $options['save_directory'] ) && $options['save_directory'] !== "" )
1008+
|| ( isset( $options['download_id'] ) && $options['download_id'] !== "" ) ) )
10091009
{
10101010
$this->fill_pdfs( $settings, $placeholder_processor );
10111011
break;

0 commit comments

Comments
 (0)