Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter omcg33

    (@omcg33)

    The problem is that in woocommerce only two call of email function(on register new customer and some other)

    ANd no call function for new order.

    Thread Starter omcg33

    (@omcg33)

    Hmmm. plugin wp smtp mailer works perfectly.
    try it

    Thread Starter omcg33

    (@omcg33)

    I found a custom solution.

    I just find class-wc-gateway-cod.php in /plugin/woocommerce/classes/gateways directory.

    This class work this “payment in cash”.

    When find function process_payment

    And if in it you see $order->update_status('on-hold'
    it is mean ,that this function works when you get a new order.

    old function:

    function process_payment ($order_id) {
    		global $woocommerce;
    
    		$order = new WC_Order( $order_id );
    
    		// Mark as on-hold (we're awaiting the cheque)
    		$order->update_status('on-hold', __( 'Payment to be made upon delivery.', 'woocommerce' ));
    
    		// Reduce stock levels
    		$order->reduce_order_stock();
    
    		// Remove cart
    		$woocommerce->cart->empty_cart();
    
    		// Return thankyou redirect
    		return array(
    			'result' 	=> 'success',
    			'redirect'	=> add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(woocommerce_get_page_id('thanks'))))
    		);
    	}

    New function:

    function process_payment ($order_id) {
    		global $woocommerce;
    
    		$order = new WC_Order( $order_id );
    
    		// Mark as on-hold (we're awaiting the cheque)
    		$order->update_status('on-hold', __( 'Payment to be made upon delivery.', 'woocommerce' ));
    
            $mailer = $woocommerce->mailer();
    
            $mailer->emails['WC_Email_New_Order']->trigger($order_id);
    
    		// Reduce stock levels
    		$order->reduce_order_stock();
    
    		// Remove cart
    		$woocommerce->cart->empty_cart();
    
    		// Return thankyou redirect
    		return array(
    			'result' 	=> 'success',
    			'redirect'	=> add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(woocommerce_get_page_id('thanks'))))
    		);
    	}

    where ‘WC_Email_New_Order’ it is a type of email.

    Thread Starter omcg33

    (@omcg33)

    OH !!! I think I’ll have to write yourself a function call to send letters

    Thread Starter omcg33

    (@omcg33)

    Did you do it?

    Thread Starter omcg33

    (@omcg33)

    Standart woocommerce function of sending email working well( i just call it in HEADER). I think there are no call of the function in woocommerce on all events

    Thread Starter omcg33

    (@omcg33)

    I think I’ll have to write yourself a function call to send letters

    Thread Starter omcg33

    (@omcg33)

    This plugin is installed and work perfectly. But woocommerce does not send emails (((

Viewing 8 replies - 1 through 8 (of 8 total)