Home › Forums › Ticket Products › Event Tickets Plus › Ticket email sends depending
- This topic has 4 replies, 3 voices, and was last updated 10 years ago by
Support Droid.
-
AuthorPosts
-
April 1, 2016 at 3:16 am #1096835
James
ParticipantHi,
My client wants customers to chose between virtual and physical tickets. To achieve this I’ve forced all tickets to not to be virtual products so that I can have shipping options. I’ve done this by using the following code:
/** * Stop tickets being virtual */ function make_ticket_physical($post_ID, $post_after, $post_before){ if($post_after->post_type == 'product'){ update_post_meta( $post_ID, '_virtual', 'no'); } } add_action( 'save_post', 'make_ticket_physical', 999999999999999999999, 3 );But now I want to be able to stop the ticket email being sent if they selected to have a physical ticket. Can you point me in the direction of where the code that fires the email being sent is? I’m hoping I can hook into the order details and stop it sending if necessary.
Thanks,
James.April 1, 2016 at 4:28 am #1096856Brian
MemberHi,
Thanks for using our plugins. I can help out here.
We have this snippet to disable the Ticket Emails in WooCommerce.
/*
* Events Tickets Plus - WooCommerce Tickets - Prevent Ticket Email from being sent.
* @ Version 4.1
*/
add_action( 'init', 'wootickets_stop_sending_email' );
function wootickets_stop_sending_email() {
if ( class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) {
$woo = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();
remove_filter( 'woocommerce_email_classes', array( $woo, 'add_email_class_to_woocommerce' ) );
add_action( 'woocommerce_email_after_order_table', array( $woo, 'add_tickets_msg_to_email' ) );
}
}
Does that give you a good starting point to work from?
Thanks
April 1, 2016 at 5:11 am #1096872James
ParticipantIs there a way to get details of the order in that function?
April 1, 2016 at 6:59 am #1096896Brian
MemberSince that is running at init I do not think it is there.
However, you would most likely remove it there and then hook in later to check the order and email there on your condition.
April 16, 2016 at 9:35 am #1103445Support 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 ‘Ticket email sends depending’ is closed to new replies.
