Home › Forums › Ticket Products › Event Tickets Plus › Add Tickets to Ticket Product Category
- This topic has 3 replies, 2 voices, and was last updated 10 years, 7 months ago by
George.
-
AuthorPosts
-
September 1, 2015 at 12:11 pm #1000997
Dan Feeley
ParticipantI 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
September 2, 2015 at 6:02 am #1001173George
ParticipantHey @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
September 3, 2015 at 3:49 am #1001561Dan Feeley
ParticipantJust 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:
Event Tickets Defaulting to "Ticket" Category on the WOO side
Thank you for your help.
September 3, 2015 at 3:24 pm #1001838George
ParticipantOkay, cool. I assume that between my solution and Barry’s, one of them works well for you! 🙂
Best of luck with your site!
George -
AuthorPosts
- The topic ‘Add Tickets to Ticket Product Category’ is closed to new replies.
