• Resolved gamethrall

    (@gamethrall)


    Hi, I love the plugin.

    I’ve been customizing the CSS and that’s been working out very well. We use a plugin that allows us to accept purchase orders. The PO number shows up in the email from WooCommerce, it’s displayed on the order screen in the admin dashboard. I tried adding it to the Invoice, but so far, to no avail.

    I saw your post about extra fields (https://wordpress.org/support/topic/extra-fields-14/). I’m not a programmer, so I can’t find how to get the field name for the purchase order number.

    If I understand what’s in the print-content.php (and I may not, as I’m not a programmer) file, it’s supposed to print out each item in the order info array. Is that correct? If it is, and I understand what print-content does, does that mean that the field isn’t part of the order information?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @gamethrall,

    Thank you for appreciating our plugin.

    Regarding the query, can you please inform us which plugin are you using for purchasing the orders? Also, it would be great if you can ask the plugin authors about how we can fetch PO numbers from the order information.

    This information will be helpful to assist you in a better way.

    Regards,
    Kenil Shah

    Thread Starter gamethrall

    (@gamethrall)

    The plugin I am using is called Purchase Orders for WooCommerce (https://wordpress.org/plugins/purchase-orders-for-woocommerce/). I reached out to them a few days ago regarding the field information. When they respond, I’ll let you know. Thanks!

    James Bumgarner

    Hi @gamethrall,

    Thank you for sharing the plugin name and the link.

    Please let us know once you hear from them.

    Regards,
    Kenil Shah

    Thread Starter gamethrall

    (@gamethrall)

    Hi @kenil802

    The plugin author says that the field is called “_purchase_order_number” and is part of the regular post meta from the order.

    From a search I did, I found this code which I thought was supposed to display the purchase order number, but it is not.

    function add_purchase_order_to_invoice_slip( $fields, $order ) {
        $new_fields = array();
            
        if( get_post_meta( $order->id, '_purchase_order_number', true ) ) {
            $new_fields['_purchase_order_number'] = array( 
                'label' => 'Purchase Order Number',
                'value' => get_post_meta( $order->id, '_purchase_order_number', true )
            );
        }
        return array_merge( $fields, $new_fields );
    }
    
    add_filter( 'wcdn_order_info_fields', ' add_purchase_order_to_invoice_slip', 10, 2 );

    Hi @gamethrall,

    Thank you for the details.

    Can you please try by replicating the $order->id with $order->get_id() and check with it is solving the issue or not.

    Please let us know how it goes.

    Regards,
    Kenil Shah

    Thread Starter gamethrall

    (@gamethrall)

    @kenil802

    That did it! (That and removing an extraneous space from add_filter that was preventing the entire block from loading). Thank you so much!

    James

    Hi @gamethrall,

    I am glad that the provided solution worked for you and it is working fine on your site.

    Please let us know if you have further queries.

    Regards,
    Kenil Shah

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Print additional fields?’ is closed to new replies.