My Woocommerce shop allows to buy for anonymous customers without email address.
One of allowed payment method is online card payment.
I added blind copy to notification mail to allow admin know about payment:
add_filter('woocommerce_email_headers', function ($header, $email_id, $order) {
if ('customer_processing_order' === $email_id) {
$header .= "BCC: MyShopAdmin <myshopadmin#domain.net>";
}
return $header;
}, 10, 3);
Works great when customer entered email during checkout process.
None of email when customer not entered email address. Yes, it's reasonable - no email address = no email.
But I want to inform shop admin about successful payment even no customer email address entered. How to do it?
Guess exists some point in Woocommerce where I can analyze email headers early before mail send init. I did not find any hooks / filters for that.
Does anybody can help me?
instead of adding filter at woocommerce_email_headers why dont you try woocommerce_payment_complete hook
This would facilitate shop admin about successful payment event
add_action( 'woocommerce_payment_complete', 'payment_complete' );
Related
I am looking for a snippet to completely disable the email notification sent out to users when an Admin changes their email in WordPress.
For context, it's this email:
[site name] Email Changed
Hi user name,
This notice confirms that your email address on [sitename] was changed to[ useremail].
If you did not change your email, please contact the Site Administrator at
[admin email]
Found this with a quick google 😉
WP Docs: https://developer.wordpress.org/reference/hooks/send_email_change_email/
<?php
// functions.php
add_filter( 'send_email_change_email', '__return_false' );
I'm developing shop on wordpress and I added payments like PayU, bank transfer, BLIK and Przelewy24. But the problem is that customer don't get email confirmation after buy a product by Przelewy24. Every other payment method is working fine - customer get email confirmation directly form shop email.
With Przelewy24 there is no emails, only from Przelewy24 but no from shop. I'm wondering why, cuz emails is enabled globally in Woocommerce and it should work with every method.
Moreover I installed plugin WP Mail Log to check sending emails and... yeah, there is no logs, with this method- shop don't send emails.
What can I do more, or where else can I check this?
Our payment gateway and CRM and not supported by WooCommerce by default as a plugin, so I need to add custom code that sends data to our CRM and payment gateway whenever a customer places an order, then reject or accept the order depending on the payment gateway API response.
Where and how in the Woo code should I be intercepting the order submission?
You should try woocommerce_checkout_process action hook where the billing provider's API response, should return an error notice to reject and stop the checkout process…
This hook is located in WC_Checkout process_checkout() method and it's before the order creation. The data is accessible through $_POST or through $posted_data = WC()->checkout->get_posted_data(); WC_Checkout method.
Or woocommerce_checkout_order_processed action hook where the order is already created (meaning that the order data is accessible through 3 arguments: $order_id, $posted_data and $order) but before payment… To stop the process the billing provider's API response should: throw new Exception()…
So anyway the solution is one of the WC_Checkout available hooks…
I would love to disable that an email is sent to a registered user, when the admin changes that users email address. Reason is, the backend is mainly used as a directory, not as a community plattform.
I haven't found the spot to overwritte so far. Any suggestions?
You can disable the email change notification by using the 'send_email_change_email' hook.
Add this in your functions.php:
add_filter('send_email_change_email', '__return_false');
I received several mails from wordpress#mydomain.tld inviting me to connect to my administration area to moderate comments.
Example :
WordPress 10/21/2013 04:22:00
A new comment on your post is waiting for your approval.
Comment: [...] You have new comment! Go link ... [...]
Please visit the Administration panel:
Sing in
Link in "Si*ng* in" redirects to a phishing page. I made several changes by changing the administration of wordpress email, but I continue to receive these messages.
I wonder if it is possible to stop sending mail wordpress# mydomain.tld
No, you can't stop someone else from pretending they are sending email from your domain. Best you can do is change the email address your wordpress instance sends email as, and then mark any email coming from the old email address as spam in your email client of choice.
I always change the default email account that Wordpress uses to send mail to something unique because of this very reason. There is no way you can prevent scammers from imitating an email address.
There are several plugins that will change the Wordpress From Email info, but to do this programmatically you can use:
function hidden_mail_from($old) {
return 'wordpress_secure#yourdomain.com';
}
add_filter('wp_mail_from', 'hidden_mail_from');
function hidden_mail_from_name($old) {
return 'My Wordpress Install 1234';
}
add_filter('wp_mail_from_name', 'hidden_mail_from_name');
If you aren't a developer I would recommend the SMTP plugin: http://wordpress.org/plugins/smtp/
And most of the other SMTP plugins on the Plugin Repository: http://wordpress.org/plugins/search.php?q=SMTP
If you are really interested you can look at the mail headers in your email client to determine the origin server of the email and potentially create a rule to filter spam out based solely on that header but the plugins are much easier.