• Hello,

    I hoping you can assist as i have a couple workflow changes and hope it work with email designer plugin.

    Here is the process:
    1. Customer places order, they are only give payment method of “Order”. (i am using Invoice Gateway For WooCommerce plugin to register order without payment) – Order status goes to “processing” and New Order email is triggered to Admin and Customer.

    2. Site owner logs in, puts order On-Hold while they edit inventory counts, add shipping costs, recalculates. On-Hold email is triggered to Customer.

    3. Site owner changes status to “Payment Pending” in order to get customer to pay now. Site owner also has to manually select “email invoice order details to customer”. Invoice email is triggered to Customer to pay.

    4. Customer logs in to pay. We have Elavon Converge payment gateway for Credit Card processing setup. Payment is successful. We have code so that it auto changes order status to Complete when payment type is Credit Card.
    – The order status goes from “Pending” to “completed”. Complete email is triggered to Customer

    PROBLEM AND QUESTIONS

    It also triggers “New Order” email again to customer and Admin. I assume because the code sates to change status to “complete” that maybe for a split second it goes to “processing”. Is there a way to put a code in so that emails are NOT triggered if payment type is “Credit Card”.

    Also, The “Customer Complete” notification, can that also be sent to Admin email? This way site owner can know that payment was successful as there is no email notification of this that i can see.

    Here is code i am using for restricting payment gateway at checkout:

    add_filter( 'woocommerce_available_payment_gateways', 'my_switch_gateways_by_context');
    
    add_action( 'woocommerce_order_status_processing_to_on-hold', 'enable_processing_to_on_hold_notification', 10, 2 );
    function enable_processing_to_on_hold_notification( $order_id, $order ){
        // Getting all WC_emails array objects
        $mailer = WC()->mailer()->get_emails();
    
        // Send the "On Hold" notification
        $mailer['WC_Email_Customer_On_Hold_Order']->trigger( $order_id );
    }
    
    function my_switch_gateways_by_context($available_gateways) {
      global $woocommerce;
    
      $endpoint = $woocommerce->query->get_current_endpoint();
    
      if ($endpoint == 'order-pay') {
        unset($available_gateways['igfw_invoice_gateway']);
      } else {
        unset($available_gateways['elavon_converge_credit_card']);
      }
      return $available_gateways;
    }

    Here is code i am using to change status to “completed”

    // Update order status based on the id of payment gateway
    function credit_card_complete_order_status( $order_id ) {
    	$order = new WC_Order( $order_id );
    	
        if ( $order->payment_method == 'elavon_converge_credit_card' )  {
          $order->update_status('completed', 'Automatically Completed');
        }
    }
    add_action( 'woocommerce_payment_complete', 'credit_card_complete_order_status' );
    • This topic was modified 4 years, 5 months ago by dmandos.
    • This topic was modified 4 years, 5 months ago by dmandos.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey,
    Unfortunately, your questions are not something I can help with, our plugin doesn’t change the way woocommerce works or triggers emails.

    I suggest reaching out to woocommerce core support. However, it sounds like you would need to hire a developer to create custom functionality for your custom purchase process.

    I’m not really sure I understand why the customer doesn’t have the option to purchase from the start using your “Elavon” payment gateway but for a complex ordering process I suggest looking into automate woo which would allow you to automate more thing and send custom emails based on triggers: https://automatewoo.com/

    All the best!

    Ben

    Thread Starter dmandos

    (@dmandos)

    We want them to only place an order. This is a wholesale website.

    Order quantities, shipping costs etc need to be confirmed and added. Customers are buying in large volumes and so the shop owner needs to confirm quantities and add shipping costs.

    This is why its order only and then manually validated.

    I looked at automate woo, but that is just automating emails for like marketing, not workflow automation.

    Thank you.

    I’m not a sales person for automatewoo I just know that you can have it trigger emails or changes to order status which seemed to be what you were going for. Anyway hiring a developer to make you something custom seems like the best option.

    All the best,

    Ben

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Email triggers’ is closed to new replies.