email-notifications

Send cancelled and failed order email to customer in Woocommerce 3

一笑奈何 提交于 2019-12-06 12:11:14
问题 I need to send cancelled and failed order email to customers in Woocommerce 3.4+ . I'm constantly getting Fatal error: Uncaught Error: Call to a member function get_billing_email() on null in I've tried few function (like below) from stackoverflow with same result: function wc_cancelled_order_add_customer_email( $recipient, $order ) { return $recipient .= "," . $order->get_billing_email(); } add_filter( 'woocommerce_email_recipient_cancelled_order', 'wc_cancelled_order_add_customer_email', 10

Different recipients based on products sold in WooCommerce email notification

只谈情不闲聊 提交于 2019-12-06 09:30:08
I’m looking to sell a number of virtual items on WooCommerce for different businesses. So when the customer has checked out, I'd like the email to be sent to the relevant business (not to admin). So when Product A is sold, an email will go to a@email.com. When Product B is sold, the email will be sent to b@email.com. When Product C is sold, the email will be sent to c@email.com...and so forth. Is there some code I can add to functions.php to achieve this? Based on " Different recipients based on product category in WooCommerce email notification " answer code, the following will allow a add a

Add a custom placeholder to email subject in WooCommerce

浪尽此生 提交于 2019-12-06 06:24:37
问题 I have a Woocommerce shop and I wanted to add a delivery_date after I accept the payment. I create a custom field in the order section named delivery_date with a date value. Now I wanted to use this custom field as a placeholder in email notification subject, like: Your order is now {order_status}. Order details are shown below for your reference: deliverydate: {delivery_date} I think the placeholder don't work like this, I need to change something in the php but I don't know where. 回答1: To

Display product custom fields as order items in Woocommerce 3

强颜欢笑 提交于 2019-12-06 01:04:41
In Woocommerce, I use custom fields to calculate the price of a product, based on this code - Set a calculated price for variable products in the WooCommerce . Thanks for the help LoicTheAztec. // Add a custom field before single add to cart add_action( 'woocommerce_before_add_to_cart_button', 'custom_product_price_field', 5 ); function custom_product_price_field(){ echo '<div class="custom-text text"> <h3>Rental</h3> <label>Start Date:</label> <input type="date" name="rental_date" value="" class="rental_date" /> <label>Period Rental:</label> <select name="custom_price" class="custom_price">

Custom Email is not sending on Order complete in WooCommerce

我怕爱的太早我们不能终老 提交于 2019-12-05 18:05:55
I am facing a problem to send a custom email in WooCommerce. Here is Error: Fatal error: Cannot use object of type WC_Order as array in /home/wp-content/themes/structure/functions.php on line 548 My client want to send a custom email when everytime customer order and pay, besides the standard order confirmation email. Here is my code: $order = new WC_Order( $order_id ); function order_completed( $order_id ) { $order = new WC_Order( $order_id ); $to_email = $order["billing_address"]; $headers = 'From: Your Name <your@email.com>' . "\r\n"; wp_mail($to_email, 'subject', 'This is custom email',

Add the New order email notification attachment to the vendor email

大憨熊 提交于 2019-12-05 14:30:27
In WooCommerce, I use woocommerce-product-vendors as multi vendor plugin. After checkout I receive as admin an a new order email notification with the attachment (uploaded file). But the vendor receive the same email but without the attachment. I need that the vendor receive the attachment too. Thanks You could try this code with a custom function hooked in woocommerce_email_recipient_new_order filter hook: add_filter('woocommerce_email_recipient_new_order', 'adding_vendor_email', 10, 2); function adding_vendor_email( $recipient, $order ) { if ( ! is_a( $order, 'WC_Order' ) ) return $recipient

How do I build a notification email/reply system like Facebook?

 ̄綄美尐妖づ 提交于 2019-12-05 02:48:36
问题 When users receive a notification email about a new private message on Facebook, they can reply to the email and have their response automatically added to the conversation on the site. How can I build a cross platform system like that? I'm building a group chat system. 回答1: This is obviously way over-simplified, but here we go: The way Facebook's emails work is by using a string that's unique to the receiver in the reply-to address: <m+50edqb50000003jtdj389k6xib6hofj6t41q1c45sdt92qc@reply

Customizing email headers in WooCommerce email notifications

北城以北 提交于 2019-12-04 20:08:32
I am trying to write a filter that changes the reply-to address for WooCommerce email, dependent on the 'billing city' the order is made for. This works for WooCommerce emails, but doesn't seem to work for WooCommerce Advanced notifications - it doesn't seem to pass the '$order' into the header information to do the IF statement. It is a long shot but any thoughts much appreciated. This is my code. function change_headers($order, $object, $headers); // Get the city $city = $order->get_billing_city(); // Change Headers if ($city == 'Manchester') { $headers = array(); $headers[] = 'Reply-to:

Send a custom email when WooCommerce checkout button is pressed

烈酒焚心 提交于 2019-12-04 19:03:18
I am trying to send a custom email whenever the checkout button is pressed for Woocommerce using PHP. This email will be sent alongside with the email notifications of wooCommerce. I have used this answer , and edited the code like: //execute some php on successfull checkout add_action( 'woocommerce_payment_complete', 'so_32512552_payment_complete' ); function so_32512552_payment_complete( $order_id ){ $order = wc_get_order( $order_id ); foreach ( $order->get_items() as $item ) { if ( $item['product_id'] > 0 ) { $_product = $order->get_product_from_item( $item ); // the message $msg = "First

Display the customer IP Address in new order email notification

£可爱£侵袭症+ 提交于 2019-12-04 18:29:04
When a new order is created, woocommerce will send an email to admin, and I want it to send customer's IP address inside the email as well. But I can't get it work, here is what I got so far: <?php echo get_post_meta( $order->id, '_customer_ip_address', true ); ?> This code goes in mytheme/woocommerce/emails/admin-new-order.php Any ideas? Thanks. (added compatibility for WooCommerce versions 3+) Update 2: Added a condition to display the address IP only for Admin New orders notification. Replaced undefined $email_id by $email->id; You can use any related hooks for the emails notifications and