WooCommerce sends blank Tickets email for non-Ticket orders

Home Forums Ticket Products Event Tickets Plus WooCommerce sends blank Tickets email for non-Ticket orders

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1100289
    Robert Staddon
    Participant

    When Events Tickets Plus is installed and WooCommerce is also being used to sell non-ticketed products, a blank “Your tickets from [store]” email will be sent to customers who make any order that does not contain ticketed items.

    The cause of this is the code in “event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php” that adds an action to “woocommerce_order_status_completed” which fires the “on_complete_order” function, which in turn fires the “complete_order” function, which then fires the “wootickets-send-tickets-email” action. Notice that the “woocommerce_order_status_completed” action triggering this sequence is fired on every WooCommerce order, whether or not it contains any tickets. Thus, a blank email is sent out for any WooCommerce orders that contain no ticketted products.

    I would suggest changing the “on_complete_order” function to first test to make sure that the order has tickets before running the “complete_order” function:

    
    	public function on_complete_order( $order_id ) {
    		$this->generate_tickets( $order_id, 'completed', 'completed' );
    
    		$has_tickets = get_post_meta( $order, $this->order_has_tickets, true );
    		if ( $has_tickets ) {
    			$this->complete_order( $order_id );
    		}
    	}
    

    This solved the problem for me. Perhaps your developers can take a look at this?

    Thanks!

    #1100352
    Geoff B.
    Member

    Good evening Robert and welcome back!

    Thank you for reaching out to us and for providing a solution to the blank email issue.
    We apologize for the inconvenience this might have caused.

    You are 100% right, this is a known bug and we will release a patch for it very soon.
    We also came up with the following temporary snippet to add to the functions.php of your theme if you prefer: https://git.io/vVoj9

    You will be contacted as soon as the fix is out.

    Best regards,

    Geoff B.

     

    #1100561
    Rainer Scheerer
    Participant

    the code from robertstaddon stoped the blank ticket mails, but also the real ticket mails at our system….

    best regards
    springstoff

    #1100716
    Robert Staddon
    Participant

    @springstoff, there was a typo in the version of the code that I pasted into the support thread. I’m sorry about that. The get_post_meta requires the $order_id as the first parameter, not a non-existent $order variable.

    Here’s the correct code:

    
    	public function on_complete_order( $order_id ) {
    		$this->generate_tickets( $order_id, 'completed', 'completed' );
    		
    		$has_tickets = get_post_meta( $order_id, $this->order_has_tickets, true );
    		if ( $has_tickets ) {
    			$this->complete_order( $order_id );
    		}
    	}
    

    If the code from @Geoff B. works, I would recommend taking that approach until they get this fixed instead of modifying the core Main.php file. This way an update wouldn’t revert your changes.

    #1101041
    Geoff
    Member

    Hey folks!

    I just wanted to chime in and let you know that Event Tickets and Event Tickets Plus 4.1.2 were just released and included a patch for this issue. Please update to the latest version when you have a chance and let us know if you continue to have any issues.

    Thanks so much for your patience while we worked on this!

    Geoff G.

    #1107191
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘WooCommerce sends blank Tickets email for non-Ticket orders’ is closed to new replies.