• I am using your example code for adding in custom order fields, i am fetching the PO from the order meta and the user role from the userdata

    function example_custom_order_fields( $fields, $order ) {
      $new_fields = array();
    
      // add PO number
      if( get_post_meta( $order->id, '_po_number', true ) ) {
        $new_fields['customer_po_number'] = array(
          'label' => 'Purchase Order Number',
          'value' => get_post_meta( $order->id, '_po_number', true )
        );
      }
    
      // add user role
      if ($order->customer_id !== 0) {
        global $wp_roles;
    
        $user_meta = get_userdata($order->customer_id);
        $roles = array();
    
        foreach ($user_meta->roles as $role) {
          $roles[] = $wp_roles->roles[$role]['name'];
        }
    
        $new_fields['customer_role'] = array(
          'label' => 'Role',
          'value' => ucwords(implode(', ', $roles))
        );
      }
      return array_merge( $fields, $new_fields );
    }
    add_filter( 'wcdn_order_info_fields', 'example_custom_order_fields', 10, 2 );

    Unfortunately, I am getting no order details from the query any longer (it was working until recently, uncertain when it stopped, we just discovered the invoice was no longer putting the role on orders

    the $order value returned is (I JSON encoded it for printing on an invoice to see what i was getting)

    {"customer_id":null,"refunds":null}

    I am getting the “label” but the value is empty on the document

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi Kender,

    Could you please create the ticket here on our support tool so that we can communicate in detail?

    Regards,
    Nikhil.

    Thread Starter kender

    (@kender)

    done

    MMM

    (@wphotographer)

    Has this been resolved? I am having the same issue since the new update 4.8.0 have reverted back to 4.7.3 as that worked fine, thank you

    Edit: Disregard as my issue may be compatibility High-performance order storage with another plugin.

    • This reply was modified 1 year ago by MMM.
    • This reply was modified 1 year ago by MMM.
    nick1122

    (@nick1122)

    Hi,

    Could you please create the ticket?here?on our support tool so that we can communicate in detail?

    Regards,
    Nikhil.

    MMM

    (@wphotographer)

    Hi Nikhil, I was using Print Invoice & Delivery Notes for WooCommerce version 4.7.3 which works fine but the update to 4.8.0 produces blank admin receipts prints on any suborders in woocommerce admin.

    I have created as you suggested a ticket #58972 on you support site and included access details to a test site, so you can test the result. It has version 4.7.3 installed so if you run a receipt print on the suborders you will see it works fine. Then update to 4.8.0 and it fails to print in suborders in woo admin. Thank you in advance.

    • This reply was modified 1 year ago by MMM.
    • This reply was modified 1 year ago by MMM.
    • This reply was modified 1 year ago by MMM.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘custom order fields no longer accessing order info’ is closed to new replies.