• Resolved madalina251

    (@madalina251)


    Hello,

    I’m using the WCMP plugin and I would like to integrate the Delivery date in the Vendor New Order Confirmation Email. Is this possible?

    I would like to integrate the delivery date that the customer selects in the checkout, in the Vendor New Order Confirmation email, to look similar to the one the customer receives from Woocommerce Order confirmation email. How is the delivery date integrated in the Woocommerce email? As I’m basically looking to do the same in the Vendor email.

    Any help would be much appreciated!

    Thanks,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Robert DeVore

    (@deviodigital)

    You can check out the following link which show the code used to add the delivery date/time to WooCommerce emails.

    The codes within this function can be used to create your custom function to add the info to your additional emails with WCMP.

    https://github.com/deviodigital/delivery-times-for-woocommerce/blob/master/admin/dtwc-woocommerce-checkout.php#L132-L175

    Thread Starter madalina251

    (@madalina251)

    Hello,

    Thanks a lot for getting back to me.

    I’ve tried to follow your suggestion and I’ve added this code to functions.php of the child theme but it’s not working. Do you have any idea what is wrong with the code and any other suggestions would be appreciated

    Thanks for your help

    /***  add delivery date to vendor new order ****/
    function dtwc_add_delivery_info_to_vendor_emails( $fields, $sent_to_admin, $order ) {
      if ( $email->id == 'vendor_new_order' ) {
         $order_id = $order->get_id();
      } else {
          $order_id = $order->id;
          $delivery_date = get_post_meta( $order_id, 'dtwc_delivery_date', true );
          $delivery_date = date( apply_filters( 'dtwc_date_format', 'M j, Y' ), strtotime( $delivery_date ) );
      if ( '' != $delivery_date ) {
           $fields[ dtwc_delivery_date_label() ] = array(
               'label' => dtwc_delivery_date_label(),
               'value' => $delivery_date,
           );
       }
      }
    
    return $fields;
    }
    add_action( 'woocommerce_email_before_order_table', 'dtwc_add_delivery_info_to_vendor_emails', 20, 4 );
    Plugin Author Robert DeVore

    (@deviodigital)

    Try this:

    https://gist.github.com/robertdevore/b10f279a87e169c9105e962230b4fc55

    The if/else statement in your code was setting the ID but wasn’t setting the $delivery_date since that part was within the else statement.

    Moving those outside of that and only using the if/else to set the ID **should** fix it.

    • This reply was modified 5 years, 4 months ago by Robert DeVore. Reason: code block editing
    • This reply was modified 5 years, 4 months ago by Robert DeVore.
    • This reply was modified 5 years, 4 months ago by Robert DeVore.
    Thread Starter madalina251

    (@madalina251)

    Hey,

    Thanks a lot for having a look at this.

    I’ve tried the code but unfortunately it seems that it doesn’t let the customer place the order in the checkout – as the payment doesn’t go through. The customer cannot make the payment, the page looks like it’s loading but then it just stops.

    I’ll search around and try different things, but if you have any other suggestions would be so appreciated!

    Thanks again for your time

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding delivery date in another email’ is closed to new replies.