Add custom order meta to Order Completed 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; }

wp_mail not sending attachment

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

Set a condition based on WooCommerce checkout city field while placing order

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

How do I hide the purchase note in the WooCommerce ‘order completed’ email?

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

WooCommerce: The model of e-mail is displaying only the html, not css [closed]

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