How to change the Customer new account email
The simplest one is to copy the mail template to your theme folder into path/to/your/theme/woocommerce/emails/customer-new-account.php and adjust the argument from user_login to user_email.
The simplest one is to copy the mail template to your theme folder into path/to/your/theme/woocommerce/emails/customer-new-account.php and adjust the argument from user_login to user_email.
paste the below code your active theme functions.php file add_filter( ‘woocommerce_email_order_meta_fields’,’custom_order_email_order_meta_data’, 10, 3 ); function custom_order_email_order_meta_data( $fields, $sent_to_admin, $order ) { $fields[‘wpcf-purchase-student’] = array( ‘label’ => __( ‘purchase amount’, ‘woocommerce’ ), ‘value’ => get_post_meta( $order->id, ‘wpcf-purchase-student’, true ) ); return $fields; }
You said in your OP that the absolute path was returned, but you are using the ‘baseurl’ value which gives you a URL to the file that you can browse to. That’s a URL, which is not the same as the path to the file in the file system. This line is your issue: $attachment … Read more
There is actually nothing wrong with the code that you have (I tested it as you have it above and it works fine). But you have to account for some additional possibilities: The wp_new_user_notification() function is a pluggable function. So it can be replaced by a plugin or by custom code. And if it is … Read more
Since you bring up SMTP, I’ll mention that you’ll probably need to make that decision before you decide how you’ll handle your “from” addresses because ultimately the direction you go with that will likely affect how you should handle the “from” address. The “simple” approach is to just filter the “from” address – that’s if … Read more
Updated The following code will add an additional recipient based on customer billing/shipping city, to new order admin notification: add_filter( ‘woocommerce_email_recipient_new_order’, ‘different_email_recipients’, 10, 2 ); function different_email_recipients( $recipient, $order ) { if ( ! is_a( $order, ‘WC_Order’ ) ) return $recipient; $city = $order->get_shipping_city(); $city = empty( $city ) ? $order->get_billing_city() : $city; // Conditionaly … Read more
I think you’re correct about that code snippet only checking the for the availability of the email. But you can probably still make your alternative approach work: the WC_Email classes set $sending to true when they’re in the process of sending. So you could check something like: WC()->mailer()->emails[“WC_Email_Customer_Completed_Order”]->sending
Well, I tested a lot of WooCommerce versions (3.3.x, 3.4.x and 3.5.x) using WP Rollback and I believe that was a error in e-mail templates that was fixed in version 3.5.2. I didn’t found nothing in the changelog about that: https://raw.githubusercontent.com/woocommerce/woocommerce/master/CHANGELOG.txt Here is the template in WooCommerce in version 3.5.2: I have to investigate more … Read more
You’re making it way more complicated than in needs to be. WP Mail SMTP is a plugin that allows you to have WP’s wp_mail() function send through an SMTP account instead of relying on the web server. You’re not, in this case, doing anything specific with WP Mail SMTP. What you’re going to do is … Read more
is one of the “two email settings you updated” the one at “WooCommerce > Settings > Emails > Email Sender Options”?