• Resolved oberning

    (@oberning)


    Hi,

    Do you know the way how to add a custom user field to the order as meta data?
    I tried some things but I am getting errors all the time:

    // Add the user meta as order meta data
    add_action( 'woocommerce_order_status_wordt-verwerkt', 'add_wefactemail_to_order_meta_data', 10, 2 );
    function add_wefactemail_to_order_meta_data( $order ) {
      $user_id = $order->get_user_id(); // Get the user id
      $wefactemail = get_user_meta( $user_id, 'KVK_nummer_2', true );
      $order->update_meta_data( 'WeFact_Billing_Email', $wefactemail );
    }

    Also, I am using the custom order status plugin from WooCommerce. So I am trying to add the action when we are updating the order status to the custom order status “wordt-verwerkt”.

    I hope you can help me out.

    Best,
    Olga

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi Olga ??

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers!

    laceyrod

    (@laceyrod)

    Automattic Happiness Engineer

    Hi there,

    This thread has been inactive for a bit, so I’m going to mark it as Resolved now for the overall health of the forums. Please feel free to utilize the resources referenced above. Alternatively, if you need to hire someone for assistance, I can recommend the following services: https://woocommerce.com/customizations/

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add user meta to order meta’ is closed to new replies.