Action or Filter when WooCommerce Ticket gets created

Home Forums Ticket Products Event Tickets Plus Action or Filter when WooCommerce Ticket gets created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1175307
    Dan Feeley
    Participant

    Basically I would like to continue this conversation is possible:

    https://theeventscalendar.com/support/forums/topic/action-or-filter-when-tickets-are-created-in-events-calender/

    Is there any action or filter that gets fired so I know when the wooticket gets created when creating an event?

    #1175415
    George
    Participant

    Hey @danfeeley,

    You can find these actions in this file within Event Tickets:

    event-tickets/src/Tribe/Tickets.php

    There you’ll find the action tribe_tickets_ticket_add, whose definition in the file looks like this (note the three arguments you can use):


    /**
    * Fired once a ticket has been created and added to a post
    *
    * @var $post_id Post ID
    * @var $ticket Ticket object
    * @var $data Submitted post data
    */
    do_action( 'tribe_tickets_ticket_add', $post_id, $ticket, $data );

    Please note that the addition of tickets happens with AJAX, so keep this in mind if you are using the hooks that run upon ticket creation and expecting to see UI changes.

    You might need or want to listen to event triggers in the JavaScript of the plugin too, not just the PHP, in which case there is a jQuery trigger when a ticket is added called saved-ticket.tribe. You can learn more about saved-ticket.tribe by heading into this file within Event Tickets:

    event-tickets/src/resources/js/tickets.js

    Cheers,
    George

    #1178217
    Dan Feeley
    Participant

    Boy was I off. Thanks George, that did it.

    #1178368
    George
    Participant

    No worries, Dan! Cheers ?

    — George

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Action or Filter when WooCommerce Ticket gets created’ is closed to new replies.