Skip to content

Commit

Permalink
Revert outputting all documents in the meta box
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadNateqi committed Apr 15, 2024
1 parent 813e746 commit e424202
Showing 1 changed file with 7 additions and 23 deletions.
30 changes: 7 additions & 23 deletions includes/class-wcpdf-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -715,31 +715,15 @@ public function data_input_box_content( $post_or_order_object ) {

do_action( 'wpo_wcpdf_meta_box_start', $order, $this );

$documents = WPO_WCPDF()->documents->get_documents();
$invoice = wcpdf_get_document( 'invoice', $order );
$packing_slip = wcpdf_get_document( 'packing-slip', $order );

foreach ( $documents as $document ) {
// Allow getting documents without invoice.
add_filter( 'wpo_wcpdf_allow_document_without_invoice', '__return_true' );

$document = wcpdf_get_document( $document->get_type(), $order );

if ( ! $document ) {
continue;
}

// Bulk documents
if ( ! empty( $document->order_ids ) ) {
foreach ( $document->order_ids as $order_id ) {
$sub_order = wc_get_order( $order_id );
$sub_document = wcpdf_get_document( $document->get_type(), $sub_order );
if ( $invoice ) {
$this->output_number_date_edit_fields( $invoice );
}

if ( $sub_document ) {
$this->output_number_date_edit_fields( $sub_document );
}
}
} else {
$this->output_number_date_edit_fields( $document );
}
if ( $packing_slip ) {
$this->output_number_date_edit_fields( $packing_slip );
}

do_action( 'wpo_wcpdf_meta_box_end', $order, $this );
Expand Down

0 comments on commit e424202

Please sign in to comment.