• Greetings,
    Hoping you can assist me. We are using https://www.ads-software.com/plugins/invoice-gateway-for-woocommerce/ to make our own custom invoice numbers (needs to be custom for certain clients). This plugin allows us to do that.
    We are also using your plugin for generating the PDF receipt and invoice we send to the customers. We need help with some code to make the custom invoice number (igfw_invoice_number) field populate in your plugin for both receipt and invoice.

    We have tried various other code examples without success. Can you assist? Love the plugin overall!

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support kenil802

    (@kenil802)

    Hi @sneakerweb,

    Could you please try adding the below code and check whether it works or not?

    Code:

    /**
    * Add this code snippet in functions.php file of your currently active theme.
    * An example that adds a ‘VAT’ and ‘Customer Number’ field to the end of the list.
    */
    function example_custom_order_fields( $fields, $order ) {
    $new_fields = array();

    if( get_post_meta( $order->id, ‘your_meta_field_name’, true ) ) {
    $new_fields[‘your_meta_field_name’] = array(
    ‘label’ => ‘VAT’,
    ‘value’ => get_post_meta( $order->id, ‘your_meta_field_name’, true )
    );
    }

    if( get_post_meta( $order->id, ‘your_meta_field_name’, true ) ) {
    $new_fields[‘your_meta_field_name’] = array(
    ‘label’ => ‘Customer Number’,
    ‘value’ => get_post_meta( $order->id, ‘your_meta_field_name’, true )
    );
    }

    return array_merge( $fields, $new_fields );
    }
    add_filter( ‘wcdn_order_info_fields’, ‘example_custom_order_fields’, 10, 2 );

    Please do let us know how it goes.

    Regards,
    Kenil Shah

    shows this

    There is a critical error on your site. Check your email for instructions.

    Learn more about debugging on WordPress.

    Thread Starter sneakerweb

    (@sneakerweb)

    AS Bruno mentioned this causes an error in WP. However removing the code

    if( get_post_meta( $order->id, ‘your_meta_field_name’, true ) ) {
    $new_fields[‘your_meta_field_name’] = array(
    ‘label’ => ‘Customer Number’,
    ‘value’ => get_post_meta( $order->id, ‘your_meta_field_name’, true )
    );
    }

    and removing } removed the error.

    How would this example work for my needs to pull in igfw_invoice_number field from the other plugin as discussed? Thank you for the help!

    Thread Starter sneakerweb

    (@sneakerweb)

    @kenil802 Are you able to help assist us further on getting this field visible on the Invoice?

    • This reply was modified 4 years, 1 month ago by sneakerweb.
    andersonmp

    (@andersonmp)

    @sneakerweb

    I am also having the same problem … no code worked … unfortunately it is not supported at all. The plugin looks good, but as it is free, the support is not the best. I would prefer to pay and have adequate support ??

    Plugin Support kenil802

    (@kenil802)

    Hi @sneakerweb,

    We are extremely sorry for the delay.

    Could you please add the below code in the functions.php file of your active theme?

    Code:
    function example_custom_order_fields( $fields, $order ) {
    $new_fields = array();
    if( get_post_meta( $order->id, ‘your_meta_field_name’, true ) ) {
    $new_fields[‘igfw_invoice_number’] = array(
    ‘label’ => ‘IGFW Invoice Number’,
    ‘value’ => get_post_meta( $order->id, ‘igfw_invoice_number’, true )
    );
    }
    return array_merge( $fields, $new_fields );
    }
    add_filter( ‘wcdn_order_info_fields’, ‘example_custom_order_fields’, 10, 2 );

    This will add the IGFW Invoice Number in the order info like this:-https://prnt.sc/vyxmcq.

    Let us know how it goes.

    Regards,
    Kenil Shah

    • This reply was modified 3 years, 11 months ago by kenil802.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Need assistance adding Custom Invoice field to Invoice’ is closed to new replies.