Created
April 4, 2018 18:39
-
-
Save barryhughes/b27845f1b39c86d3900bd8df897cda2a to your computer and use it in GitHub Desktop.
Programmatically add a WooCommerce ticket (Event Tickets Plus 4.7.1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance()->ticket_add( $event_id, [ | |
'ticket_name' => 'Test ticket ' . uniqid(), | |
'ticket_provider' => 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main', | |
'ticket_price' => '100', | |
'tribe_ticket' => [ | |
'mode' => 'global', | |
'event_capacity' => '100', | |
'capacity' => '' | |
], | |
'ticket_description' => 'Wine and cheese night', | |
'ticket_show_description' => '1', | |
'ticket_start_date' => '', | |
'ticket_start_time' => '', | |
'ticket_end_date' => '', | |
'ticket_end_time' => '', | |
'ticket_sku' => uniqid(), | |
'ticket_id' => '', | |
] ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In case anyone is finding this some time later... the syntax has changed a bit (I'm using Event TIckets 5.2.2).
To set the capacity use 'tribe-ticket' with a dash instead of underscore
Options for 'mode' are