Support » Plugin: WooCommerce PDF Invoices » Multiple add_filter for wpi_invoice_information_meta

  • I have a website with woocommerce with two add_filter for wpi_invoice_information_meta

    1st one is in my function.php :

    function add_invoice_information_meta( $info, $invoice ) {
    	// Mercedes purchase order
    	if ( $po = WPI()->get_meta($invoice->order, '_billing_purchase_order') ) {
    		$info['po_number'] = array(
    			'title' => __( 'Purchase Order :', 'woocommerce-pdf-invoices' ),
    			'value' => $po,
    		);
    	}
    	return $info;
    }
    add_filter( 'wpi_invoice_information_meta', 'add_invoice_information_meta', 10, 2 );

    2nd one is in a plugin class file :

    class ThisIsAClass
    	{
    		public function __construct ()
    		{
    			add_filter( 'wpi_invoice_information_meta', array($this, 'my_function', 11, 2) );
    		}
    
                    function my_function( $info, $invoice ) {
    	// Mercedes purchase order
    	if ( $po = WPI()->get_meta($invoice->order, '_billing_purchase_order') ) {
    		$info['po_number'] = array(
    			'title' => __( 'Purchase Order :', 'woocommerce-pdf-invoices' ),
    			'value' => $po,
    		);
    	}
    	return $info;
           }
    }

    The problem is that nothing is show in the metadata box in the pdf invoice !!
    When a delete the 2nd filter everything is working ! Can’t find where us the problem !!

    Any idea about how to solve that ?

  • You must be logged in to reply to this topic.