• Resolved mikesee

    (@mikesee)


    Hi,

    I was trying to update your plugin to not include the EMT payment instructions on the order processing email sent to customers.

    When I try to update this section:
    public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
    if ( $this->instructions && ! $sent_to_admin && ’emt’ === $order->get_payment_method() &&
    ( $order->has_status(‘on-hold’) || $order->has_status(‘processing’) || $order->has_status(‘pending’) ) ) {
    echo wpautop( wptexturize( $this->get_instructions( $order ) ) ) . PHP_EOL;
    }

    When I remove status order->has_status(‘processing’), the EMT instructions are no longer included inall customer emails. Could you provide some guidance on how to remove from these emails?

    • This topic was modified 5 years, 10 months ago by mikesee.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Your on the right track, but note that “On-Hold” statuses are initially saved in WooCommerce as “Processing” status then changed after the fact.

    Comment out or remove ine 364 of gateway-interac.php:
    ( $order->has_status('on-hold') || /*$order->has_status('processing') ||*/ $order->has_status('pending') ) ) {

    And then change the default Order Status setting for the Email Money Transfer plugin (under WooCommerce -> Settings -> Payments) to Pending instead of on-hold.

    That fixed this for me.

    Actually, I stand corrected. It thought this was working, but Pending order statuses don’t actually seem to have an email notification tied to them, so you need to keep it as “on-hold”.

    Removing ‘processing’ from the line 364 actually DOES seem to show the message for on-hold orders only (however, ADMIN order emails will not have the instructions, and maybe this was throwing you off) but it should work they way you intended.

    Apologies for the confusion in my earlier reply.

    Thread Starter mikesee

    (@mikesee)

    Tried removing ‘processing’ from that line and its working exactly how we were wanting it to. Appreciate that responses!!

    Hi,

    I have encountered the same problem as the author of the post and followed the comment out order->has_status(‘processing’) method as suggested.

    However, when I update an order’s on-hold status to processing, I get the following error every time:

    “There has been a critical error on your website. Please check your site admin email inbox for instructions.

    Learn more about debugging in WordPress.”

    Also, I stopped receiving the processing-order email notification since.

    Please help!

    Thread Starter mikesee

    (@mikesee)

    This is how I updated my code to get it to work.

    if ( $this->instructions && ! $sent_to_admin && 'emt' === $order->get_payment_method() && 
    				( $order->has_status('on-hold') || $order->has_status('pending') ) ) { 
    				echo wpautop( wptexturize( $this->get_instructions( $order ) ) ) . PHP_EOL;
    		}
    		}

    See if that works for you.

    Thanks for the help mikesee but unfortunately, after I replaced the codes with that. I got a “There is a critical error on your website” error message and I wasn’t able to browse the website.

    Thread Starter mikesee

    (@mikesee)

    Do you have access to FTP or cpanel in hosting? You will need to edit the file via those methods as you can’t use plugin editor in your site.

    Yes, I have been downloading the file via FTP, making the changes with the Visual Studio Code editor, saved it and uploaded it to overwrite the original file.

    It still gives the “There has been a critical error on your website. Please check your site admin email inbox for instructions.” error.

    However, I have yet to receive any of those emails in my inbox (I checked the email set as admin email so that wasn’t a problem).

    Also, there is no error showing in the developer tools console.

    Okay, so I have finally figured out that for some reason, the email-processing-order.php was corrupted, so that was why I got a critical error when updating from on-hold to processing.

    I have replaced the php file with a new one and it’s working fine now! Thanks for all the help!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Remove EMT Instructions on Processing Emails’ is closed to new replies.