Support » Plugin: Advanced Order Export For WooCommerce » Add custom field to export from invoice plugin

  • Resolved spirit1977

    (@spirit1977)


    Hi,

    I’m using the Pro plugin of the free WooCommerce PDF Invoices & Packing Slips because I have to make refunds in my shop.

    I was trying to add the fields “_wcpdf_credit_note_number” or “_wcpdf_formatted_credit_note_number” to my export, but they are not available in the meta key list.

    Is there any way I can add them to the export?

    Thanks in advance.

    Mark

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author algol.plus

    (@algolplus)

    hi Mark

    Could you send “WooCommerce PDF Invoices & Packing Slips Professional” to aprokaev@gmail.com ?

    thanks, alex

    Thread Starter spirit1977

    (@spirit1977)

    Sent you the plugin. Thanks.

    Plugin Author algol.plus

    (@algolplus)

    hi Mark

    thank you!
    try add following code to functions.php

    add_filter('woe_get_order_fields', 'woe_add_order_fields');
    function woe_add_order_fields($fields) {
    	$fields['credit_note_number'] = array( 'label' => 'Credit Note Number', 'colname' => 'Credit Note Number', 'checked' => 1 );
    	return $fields;
    }
    add_filter('woe_get_order_value_credit_note_number', 'woe_get_credit_note_number', 10, 3);
    function woe_get_credit_note_number($value,$order, $field) {
    	 $refunds = $order->get_refunds();
     	 if ( !empty( $refunds ) )  // take 1st!
    		$value = get_post_meta( $refunds[0]->id, '_wcpdf_credit_note_number', true);
    	return $value;
    }
    Thread Starter spirit1977

    (@spirit1977)

    Many thanks, works perfectly

    Hello algolplus and Mark

    I add that code to the functions.php of my theme and I get an HTTP Error 500. What am I doing wrong?

    Thanks

    Plugin Author algol.plus

    (@algolplus)

    hello bazilator

    Did you put this code inside tags <?php … ?>

    thanks, alex

    Nope because the tag <?php is at the beginning of the functions.php file…

    Thanks

    Plugin Author algol.plus

    (@algolplus)

    I suggest you check error logs ( in cpanel or in wordpress folder)

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Add custom field to export from invoice plugin’ is closed to new replies.