Add Tickets to Ticket Product Category

Home Forums Ticket Products Event Tickets Plus Add Tickets to Ticket Product Category

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

    I guess this feature was removed on WooTickets 3.11:

    11. A new action has been added! wootickets_generate_ticket_attendee – Tickets are no longer auto-added to a “Tickets” product category upon creation. Anyone still desiring this functionality can leverage this action.

    Any chance you point me in the right direction to get it added back using the new action?

    Thank You

    #1001173
    George
    Participant

    Hey @danfeeley,

    Just to be clear, do you mean that you want it so that when tickets are created, they are added to one of WooCommerce’s “Product Categories” (specifically, a product category named “tickets”)?

    If so, then this will unfortunately take a bit of custom coding beyond the scope of the support forums but should generally be possible by filtering the “$attendee” variable right before the wootickets_generate_ticket_attendee bit of code that your post mentions here in this thread.

    If you’re not familiar with the WordPress function wp_insert_post(), first read up on this here → https://codex.wordpress.org/Function_Reference/wp_insert_post

    Then, head to your theme’s functions.php file. You’ll be able to add custom taxonomies to the ticket by using code like this:


    add_filter( 'wootickets_attendee_insert_args', 'danfeeley_example', 10, 4 );

    function danfeeley_example( $attendee, $order_id, $product_id, $event_id ) {

    $attendee['tax_input] = array(
    'product_cat' => array(
    'Ticket'
    )
    );

    return $attendee;
    }

    This uses the ‘tax_input’ option in the aforementioned wp_insert_post() function to add a taxonomy to the post arguments before it is created.

    I hope this helps!

    George

    #1001561
    Dan Feeley
    Participant

    Just to be clear, do you mean that you want it so that when tickets are created, they are added to one of WooCommerce’s “Product Categories” (specifically, a product category named “tickets”)?

    Yes, that is correct. I was looking to restore the same functionality that was in WooTickets 3.10. As it turns out Barry had a solution for that:

    https://theeventscalendar.com/support/forums/topic/event-tickets-defaulting-to-ticket-category-on-the-woo-side/

    Thank you for your help.

    #1001838
    George
    Participant

    Okay, cool. I assume that between my solution and Barry’s, one of them works well for you! 🙂

    Best of luck with your site!
    George

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Add Tickets to Ticket Product Category’ is closed to new replies.