Support » Plugin: WooCommerce » Hook for when customer is loaded in admin order

  • Resolved cornelisdigitaal

    (@connectcase)


    Hi there,

    I am looking for the hook that fires when creating an admin order and the customer has been searched and selected (so when the Billing and Shipping details are loaded).

    After googling for several hours I was told it is “woocommerce_ajax_get_customer_details”, but that does not seem to do anything.

    Can anyone think of such a hook?

    Cheers,

    Cees

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Aashik P – a11n

    (@aashik)

    Hello Cees,

    Does woocommerce_admin_order_data_after_order_details help?

    https://github.com/woocommerce/woocommerce/blob/release/5.3/includes/admin/meta-boxes/class-wc-meta-box-order-data.php#L310

    There’s also woocommerce_admin_order_data_after_billing_address and woocommerce_admin_order_data_after_shipping_address that loads as such:

    hook
    Link to image: https://d.pr/i/FWfcoP

    Thread Starter cornelisdigitaal

    (@connectcase)

    No, those hooks print something on certain positions.

    I need something to happen when the customer is has been selected.

    Thanks!

    Plugin Support Aashik P – a11n

    (@aashik)

    Thanks for clarifying.

    I’m not sure of hooks that might trigger based on your requirement. 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.`

    Thread Starter cornelisdigitaal

    (@connectcase)

    Cheers!

    I figured it out… well, to a certain degree. First I add a custom field to the billing fields array, using: woocommerce_admin_billing_fields and then I change the value of that field using: woocommerce_ajax_get_customer_details

    So far I have it working with a text field, but I really want “woocommerce_admin_billing_fields” to add a select and then have “woocommerce_ajax_get_customer_details” add the options.

    Any change of shining a light on that?

    Plugin Support Rambo

    (@rahul020691)

    Hello,

    There hasn’t been much activity on this thread, so I recommend visiting the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. Those are the best places to get assistance related to customization.

    Thanks!

    @connectcase

    How were you able to pass $data using woocommerce_ajax_get_customer_details?

    In my filter I have:

    $data['shipping']['shipping_noti-email-order']['value'] = get_user_meta( $user_id, 'shipping_noti-email-order', true );
        return $data;

    This outputs to the correct form-field, but the output reads as:
    [object Object]

    I get the same output no matter what I assign to [‘value’], any tips?

    @connectcase

    Well I answered my own question by looking at another thread of yours! Turns out I didn’t need [‘value’], I got confused while look at how array is represented in a different file… Well thanks!

    Thread Starter cornelisdigitaal

    (@connectcase)

    Glad to be of service! Cheers!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Hook for when customer is loaded in admin order’ is closed to new replies.