woocommerce edit order before send to clients email - wordpress

Im using wordpress with woocommerce.
I cant find solution how to NOT send automatically email after purchase order, but admin can edit and add extra shiping cost individualy and then send email.
Thank you everyone for help.

I figure it out! This code put in functions.php file
function my_change_status_function ($order_id) {$order = new WC_Order($order_id); return 'on-hold';}

Related

Wordpress Woocommerce plugin mail triggering

Mail not sending when status changed from processing to on-hold and processing to failed.
Kindly tell me how to achieve this. Thanks in advance
Even that kind of questions (directly asking the need without any research or any part of code) are not welcomed here, I want to help you about that by giving the basic idea.
In the file "wp-content/plugins/woocommerce/includes/class-wc-emails.php", search for the "public static function init_transactional_emails()" and check "$email_actions" array there.
$email_actions = apply_filters(
'woocommerce_email_actions', array(
'woocommerce_low_stock',
'woocommerce_no_stock',
'woocommerce_product_on_backorder',
'woocommerce_order_status_pending_to_processing',
'woocommerce_order_status_pending_to_completed',
'woocommerce_order_status_processing_to_cancelled',
'woocommerce_order_status_pending_to_failed',
'woocommerce_order_status_pending_to_on-hold',
'woocommerce_order_status_failed_to_processing',
'woocommerce_order_status_failed_to_completed',
'woocommerce_order_status_failed_to_on-hold',
'woocommerce_order_status_on-hold_to_processing',
'woocommerce_order_status_on-hold_to_cancelled',
'woocommerce_order_status_on-hold_to_failed',
'woocommerce_order_status_completed',
'woocommerce_order_fully_refunded',
'woocommerce_order_partially_refunded',
'woocommerce_new_customer_note',
'woocommerce_created_customer',
)
);
Since after every update of Woocommerce plugin any changes you made on those files will be gone, you need to add your email trigger for status changes you mentioned by either using a hook or overriding the files using your child theme.
About your request, for "from processing to on-hold" you need to add:
'woocommerce_order_status_processing_to_on-hold',
About overriding a file (or function) from includes folder of Woocommerce you may check this post: Override woocommerce files from includes folder
I hope this will help you to solve it. Have a good day.

Basic PHP, guidance needed for Woocommerce customer email

I know this is basic PHP, but I am just starting off. I'm editing the Woocommerce email template for customer confirmation emails /woocommerce/emails/customer-processing-order.php
I need to add a link which pulls the customer email and products ordered into the URL. This is where I am up to:
<div style="text-align:center">
Click here
</div>
This is not working for me, but I appreciate my basic PHP knowledge is poor so I've probably made a pretty fundamental mistake here. How can I reference customers email and products ordered into a URL string? Thanks.
First of all, it is a wrong practice to update the email templates located at /woocommerce/emails/ directory directly.
If you need to make customization for woocommerce email templates, you need to copy, the file
from /woocommerce/emails/customer-processing-order.php to
content/themes/yourtheme/woocommerce/emails/customer-processing-order.php .
Refer https://docs.woocommerce.com/document/template-structure/ for details.
For the rest, I as stated by #Jignesh , just pass order id , in the url and then in the template, you may get order details using
$order = wc_get_order( $order_id );

Send thank you email in wordpress after user is redirected from other website

This is the problem I am trying to find a solution to: I manage a wordpress site that deals with donations. There are 5 options. Once the user clicks on one of them they are sent to a third party site to make a donation. After they make the donation they are redirected back to my site with a set of data (name, email etc.). What I need to do is get that data and send a thank you email to the user. Is there some wordpress plugin I can use to handle the incoming data and send the email? Or maybe use a plugin like Contact form 7 to do it? I am not really familliar with wordpress. Really basic knowledge
The easiest way to do this would be to create a custom page template with logic to capture the data sent after donating in it and apply the template to a page.
E.g.
wp-content/themes/your-theme/ipn.php
<?php
/**
* Template Name: IPN
*/
// Grab the data that's returned, however it's returned.
$data = $_GET['data'];
// Use WordPress mail function to send your email
wp_mail( $to, $subject, $message, $headers, $attachments );
// Either redirect to another page or display a thank you message.
Then go into your admin, create a new page called IPN, select your page template from the drop down and publish. You can use the URL to this page to pass data back to it from the 3rd party site after payment.

Notify email when someone's posted a review in WooCommerce

I noticed that Woocommerce's reviews are managed through Wordpress Comments. But why is it that Wordpress isn't notifying my email when someone posted a review to a product. I have set the "Email me whenever anyone posted a comment".
Is this function available in Woocommerce or i'm missing something?
Please advise, thanks everyone!
Regards, Ven
By default Wordpress sends a notification to the author of the product/post (the person who created the product in your instance). The suggested site owner (settings > general) is not the recipient of these notifications. This is where the trouble might start. This author information is in Woocommerce hidden and is hard to figure out who that is in your user database. It might be that the original author of the product doesn't exist anymore, and especially if the original author has been deleted from the database and you didn't move the contents of that user to a new user.
The default comment notifications are produced in this Wordpress file: wp-includes/pluggable.php
Below is a trick to override the recipient for the comment/review notification, put this code in your child-theme's functions.php and change the part example#example.com to your desired email recipient and you will receive a notification every time someone adds a comment/review to your site.
function new_comment_moderation_recipients( $emails, $comment_id ) {
return array( 'example#example.com' );
}
add_filter( 'comment_moderation_recipients', 'new_comment_moderation_recipients', 24, 2 );
add_filter( 'comment_notification_recipients', 'new_comment_moderation_recipients', 24, 2 );
I tested it and it works.
On the Wordpress Dashboard navigate to Settings > General and the Email address listed here is where you will get notifications.

How to remove woocommerce check out page's default email address text

By default email field is showing email address from wordpress general settings , I want to show a custom text like 'example#example.com' in this field as a place holder value. Please advise
None of the answers solved my problem either...
Took me a while to work this out, really simple in the end, just put this at the end of your functions.php file and change the value to whatever you want.
function woocommerce_change_checkout_field_value() {
echo "<script>document.getElementById('billing_email').value = 'Your value here';</script>";
}
add_action( 'woocommerce_after_checkout_form', 'woocommerce_change_checkout_field_value');
Go to your dashboard -> Woocommerce -> Settings -> Emails -> Email options, you will see ""From" Name" and ""From" Email Address", change those and it should change it on the email.
More information about configuring some of the basic options on woocommerce you can visit this page.
You need to implement checkout field customization hook for doing this. Its correct way of doing it.
Please refer to this : https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
get WooCommerce Checkout Manager
then complete Replace Placeholder Name of your field.

Resources