Is there a hook for confirmation e-mail?

Hello, I am once again developing a custom shipping plugin. I have some extra fields that I have added before the shipping (using before_shipping_form() in a shipping plugin).

Are there any useful hooks I can use to add this information to the client as well as the store admin? I would obviously rather not mess with the core files if I can avoid it.


  • pro120
    • Design Lord, Child of Thor

    I’m unclear on how you want this information displayed. I’m positive there are some hooks and filters that can help accomplish what your looking for, but maybe explain a little more about what your trying to achieve.

  • digitalmarauders
    • WPMU DEV Initiate

    At it’s simplest form possible I would just like to add something to the confirmation e-mail (particularly the email going to the store admin).

    I cannot simply edit the core files because the variable will likely be a session variable, or generated in some other way.

    Thanks for checking Phil!

  • Aaron
    • CTO

    For new order notification, there is only a filter on the one to the customer:

    $msg = apply_filters( 'mp_order_notification_' . $_SESSION['mp_payment_method'], $msg, $order );

    The admin email does not have a filter currently, though I’ll add one next version like this:

    $subject = apply_filters( 'mp_order_notification_admin_subject', $subject, $order );

    $msg = apply_filters( 'mp_order_notification_admin_msg', $msg, $order );

    The order shipped email to customer has multiple filters.

    Also, you can add info to multiple places on the admin’s order details screen. The shipping plugin class contains a method for this, or you can use

    <?php do_action('mp_single_order_display_shipping', $order); ?> or even add your own meta box

    do_action('mp_single_order_display_box', $order);

  • digitalmarauders
    • WPMU DEV Initiate

    Thinks folks, those hooks are definitely helpful…however….it brings up a different set of issues.

    Obviously if I use ‘mp_single_order_display_box’ to create my own metabox I cannot rely on a session variable, because that will show the admin’s variable rather than the customer. Is there a way I can update the $order variable to have a unique value per order?

    Thanks for your time, thanks once again.

  • Aaron
    • CTO

    line 2539:

    if (isset($_POST['special_instructions']))
    $_SESSION['mp_shipping_info']['special_instructions'] = trim(stripslashes($_POST['special_instructions']));

    //for checkout plugins
    do_action( 'mp_shipping_process' );

    You can just tie into that action and save your own form fields to the array. Line 4133 is where it’s printed in the order details screen.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.