WordPress.org

Forums

Order Delivery Date for WooCommerce
[resolved] Delivery Date in Subject of New Order Email (7 posts)

  1. brandonecarr
    Member
    Posted 3 years ago #

    Good day-

    I know that a subject can be changed from the functions.php, but how would I insert the delivery date into the following?

    /*
    * goes in theme functions.php or a custom plugin
    *
    * Subject filters:
    * woocommerce_email_subject_new_order
    * woocommerce_email_subject_customer_procesing_order
    * woocommerce_email_subject_customer_completed_order
    * woocommerce_email_subject_customer_invoice
    * woocommerce_email_subject_customer_note
    * woocommerce_email_subject_low_stock
    * woocommerce_email_subject_no_stock
    * woocommerce_email_subject_backorder
    * woocommerce_email_subject_customer_new_account
    * woocommerce_email_subject_customer_invoice_paid
    **/
    add_filter('woocommerce_email_subject_new_order', 'change_admin_email_subject', 1, 2);

    function change_admin_email_subject( $subject, $order ) {
    global $woocommerce;

    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

    $subject = sprintf( '[%s] New Customer Order (# %s) from Name %s %s', $blogname, $order->id, $order->billing_first_name, $order->billing_last_name );

    return $subject;
    }

    http://wordpress.org/plugins/order-delivery-date-for-woocommerce/

  2. Vishal Kothari
    Member
    Plugin Author

    Posted 3 years ago #

    Hi Brandon,

    I will need to check on this. I will let you know by tomorrow on how to add the delivery date in the subject line of the email.

    Thank you.

    :Ashok

  3. Vishal Kothari
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Brandon,

    You can include the delivery date in the subject as shown below:

    $subject = sprintf( '[%s] New Customer Order (# %s) from Name %s %s, Delivery date (%s)', $blogname, $order->id, $order->billing_first_name, $order->billing_last_name,$_POST['e_deliverydate'] );

    :Ashok

  4. Vishal Kothari
    Member
    Plugin Author

    Posted 2 years ago #

    Never heard back on this from you.

  5. brandonecarr
    Member
    Posted 2 years ago #

    Hi ashokrane-

    Sorry for the late reply. it's been quite the hectic time lately!

    In what file will I call up this code?

    Thank you sir, hope you had a great Labor Day, and have a great day!

  6. brandonecarr
    Member
    Posted 2 years ago #

    Ashok-

    I got this all figured out! Thanks so much for your help. For anyone trying to complete the same action, here is the code that I used and added my functions.php file:

    /*
    * goes in theme functions.php or a custom plugin
    *
    * Subject filters:
    * woocommerce_email_subject_new_order
    * woocommerce_email_subject_customer_procesing_order
    * woocommerce_email_subject_customer_completed_order
    * woocommerce_email_subject_customer_invoice
    * woocommerce_email_subject_customer_note
    * woocommerce_email_subject_low_stock
    * woocommerce_email_subject_no_stock
    * woocommerce_email_subject_backorder
    * woocommerce_email_subject_customer_new_account
    * woocommerce_email_subject_customer_invoice_paid
    **/
    add_filter('woocommerce_email_subject_new_order', 'change_admin_email_subject', 1, 2);

    function change_admin_email_subject( $subject, $order ) {
    global $woocommerce;

    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

    $subject = sprintf( 'Delivery date: %s for %s %s in %s', $_POST['e_deliverydate'], $order->billing_first_name, $order->billing_last_name, $order->billing_city );

    return $subject;
    }

    Thanks for the awesome plugin!

    Good luck to all!

  7. bhavik.kiri
    Member
    Plugin Contributor

    Posted 2 years ago #

    Hi Brandon,

    Thanks for sharing your solution on this topic.

    Regards,
    Bhavik Kiri

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Order Delivery Date for WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.