Ticket email sends depending

Home Forums Ticket Products Event Tickets Plus Ticket email sends depending

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1096835
    James
    Participant

    Hi,

    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.

    #1096856
    Brian
    Member

    Hi,

    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

    #1096872
    James
    Participant

    Is there a way to get details of the order in that function?

    #1096896
    Brian
    Member

    Since 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.

    #1103445
    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 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Ticket email sends depending’ is closed to new replies.