Home › Forums › Ticket Products › Event Tickets Plus › WooCommerce sends blank Tickets email for non-Ticket orders
- This topic has 5 replies, 5 voices, and was last updated 9 years, 11 months ago by
Support Droid.
-
AuthorPosts
-
April 8, 2016 at 3:51 pm #1100289
Robert Staddon
ParticipantWhen 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!
April 8, 2016 at 7:06 pm #1100352Geoff B.
MemberGood 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/vVoj9You will be contacted as soon as the fix is out.
Best regards,
Geoff B.
April 10, 2016 at 4:57 am #1100561Rainer Scheerer
Participantthe code from robertstaddon stoped the blank ticket mails, but also the real ticket mails at our system….
best regards
springstoffApril 11, 2016 at 5:39 am #1100716Robert 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.
April 11, 2016 at 3:38 pm #1101041Geoff
MemberHey 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.
April 26, 2016 at 9:35 am #1107191Support Droid
KeymasterThis 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. -
AuthorPosts
- The topic ‘WooCommerce sends blank Tickets email for non-Ticket orders’ is closed to new replies.
