Home › Forums › Ticket Products › Event Tickets Plus › Conditional statement when tickets are not being sold through WooTickets?
- This topic has 5 replies, 2 voices, and was last updated 9 years, 1 month ago by Barry.
-
AuthorPosts
-
April 7, 2015 at 4:29 pm #953873designstudioParticipant
Hello,
I was wondering if there is a conditional statement to know if an event ticket is being sold through WooTickets? The reason being is that our client is phasing out Gravity Forms to sell tickets but he has hundreds of events that are already using GF, so what I want to accomplish is that when ever an event ticket is not being sold through WooTickets to use GF.
April 7, 2015 at 5:11 pm #953907BarryMemberHi designstudio,
That’s an interesting scenario.
How about using tribe_events_product_is_ticket() to differentiate? If you pass in a product ID and it is a “ticket product” managed by our own ticketing plugins, it should return true.
Does that work for you here?
April 8, 2015 at 9:09 am #954064designstudioParticipantHi Barry,
Sounds like that will work. How would I get the product id?
Andy
April 8, 2015 at 10:43 am #954112BarryMemberIt’s not too easy for me to answer this question as I’m not entirely sure how your Gravity Forms-based solution has been put together or when/where it runs.
Where is it pulling its list of products from? I’m missing a few pieces of the puzzle here and you or whomever put the customization together should really be better placed to take things forward at this point.
April 8, 2015 at 11:53 am #954145designstudioParticipantHello Barry,
I was actually trying to get product id from WooTickets and found some helpful code in the TribeWooTickets class where you have something similar to:
global $post;
$agh_ticket_query = new WP_Query(
array(
‘post_type’ => ‘product’,
‘meta_key’ => ‘_tribe_wooticket_for_event’,
‘meta_value’ => $post->ID,
‘meta_compare’ => ‘=’,
‘posts_per_page’ => – 1,
‘fields’ => ‘ids’,
‘post_status’ => ‘publish’,
)
);
$agh_ticket_ids = $agh_ticket_query->posts;
$event_has_wooticket = tribe_events_product_is_ticket($agh_ticket_ids[0]);Thanks for the help,
AndyApril 8, 2015 at 11:54 am #954148BarryMemberAwesome, glad you’re all sorted here 🙂
-
AuthorPosts
- The topic ‘Conditional statement when tickets are not being sold through WooTickets?’ is closed to new replies.