change priority on generate_Tickets

Home Forums Ticket Products Event Tickets Plus change priority on generate_Tickets

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #59635
    infamia
    Participant

    Hello Barry et al.

    First, thanks for yoru help on removing ticket email (https://theeventscalendar.com/support/forums/topic/remove-tickets-email/#post-58586 ). This worked.

    Now I’m having a related problem: when I try to add the emails to the “order completed’ email, it doesn’t work. Hoewver if I resend the “order completed” email, it works! I have a feeling this is because the email goes out before tickets get generated.

    Do you have a snippet perhaps to reprioritize ticket generation? essentially change wootickets/classes/class-wootickets.php line 101
    from:
    add_action( ‘woocommerce_order_status_completed’, array( $this, ‘generate_tickets’ ), 12 );

    to:
    add_action( ‘woocommerce_order_status_completed’, array( $this, ‘generate_tickets’ ), 0 );

    I can hard-wire it and it works…

    #59637
    infamia
    Participant

    Woudl this code work:

    remove_action( 'woocommerce_order_status_completed', array(TribeWooTickets::get_instance(), 'generate_tickets'));
    add_action( 'woocommerce_order_status_completed', array(TribeWooTickets::get_instance(),'generate_tickets'), 0 );

    in functions.php

    #59660
    Barry
    Member

    Yes you can basically reorder actions in that way except when removing an action you must specify the original priority, unless of course it happens to be the default priority.

    #59673
    infamia
    Participant

    Hey Barry.

    It seems to work. I changed the code to


    //*reprioritize ticket generation
    remove_action( 'woocommerce_order_status_completed', array(TribeWooTickets::get_instance(), 'generate_tickets'), 12 );
    add_action( 'woocommerce_order_status_completed', array(TribeWooTickets::get_instance(),'generate_tickets'), 0 );

    Thanks again for your continued help.

    #59828
    Barry
    Member

    No problem at all, thank you for checking in with the final solution – could definitely be useful for others here 🙂

    #979445
    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 ‘change priority on generate_Tickets’ is closed to new replies.