tes, 'woocommerce-pdf-invoices-packing-slips' ) : false; return apply_filters( 'wpo_wcpdf_shipping_notes', $shipping_notes, $this ); } public function shipping_notes() { echo $this->get_shipping_notes(); } /** * wrapper for wc_price, ensuring currency is always passed */ public function format_price( $price, $args = array() ) { $args['currency'] = $this->order->get_currency(); $formatted_price = wc_price( $price, $args ); return $formatted_price; } public function wc_price( $price, $args = array() ) { return $this->format_price( $price, $args ); } /** * Gets price - formatted for display. * * @access public * @param mixed $item * @return string */ public function get_formatted_item_price ( $item, $type, $tax_display = '' ) { if ( ! isset( $item['line_subtotal'] ) || ! isset( $item['line_subtotal_tax'] ) ) { return ''; } $divide_by = ($type == 'single' && $item['qty'] != 0 )?abs($item['qty']):1; //divide by 1 if $type is not 'single' (thus 'total') if ( $tax_display == 'excl' ) { $item_price = $this->format_price( ($this->order->get_line_subtotal( $item )) / $divide_by ); } else { $item_price = $this->format_price( ($this->order->get_line_subtotal( $item, true )) / $divide_by ); } return $item_price; } public function get_invoice_number() { // Call the woocommerce_invoice_number filter and let third-party plugins set a number. // Default is null, so we can detect whether a plugin has set the invoice number $third_party_invoice_number = apply_filters( 'woocommerce_invoice_number', null, $this->order_id ); if ($third_party_invoice_number !== null) { return $third_party_invoice_number; } if ( $invoice_number = $this->get_number('invoice') ) { return $formatted_invoice_number = $invoice_number->get_formatted(); } else { return ''; } } public function invoice_number() { echo $this->get_invoice_number(); } public function get_invoice_date() { if ( $invoice_date = $this->get_date('invoice') ) { return $invoice_date->date_i18n( wcpdf_date_format( $this, 'invoice_date' ) ); } else { return ''; } } public function invoice_date() { echo $this->get_invoice_date(); } public function get_document_notes() { if ( $document_notes = $this->get_notes( $this->get_type() ) ) { return $document_notes; } else { return ''; } } public function document_notes() { $document_notes = $this->get_document_notes(); if( $document_notes == strip_tags( $document_notes ) ) { echo nl2br( $document_notes ); } else { echo $document_notes; } } public function document_display_date() { $document_display_date = $this->get_display_date( $this->get_type() ); //If display date data is not available in order meta (for older orders), get the display date information from document settings order meta. if ( empty( $document_display_date ) ) { $document_settings = $this->settings; if( isset( $document_settings['display_date'] ) ) { $document_display_date = $document_settings['display_date']; } else { $document_display_date = 'invoice_date'; } } $formatted_value = $this->get_display_date_label( $document_display_date ); return $formatted_value; } public function get_display_date_label( $date_string ) { $date_labels = array( 'invoice_date' => __( 'Invoice Date' , 'woocommerce-pdf-invoices-packing-slips' ), 'order_date' => __( 'Order Date' , 'woocommerce-pdf-invoices-packing-slips' ), ); if( isset( $date_labels[$date_string] ) ) { return $date_labels[ $date_string ]; } else { return ''; } } } endif; // class_exists