Conditional statement when tickets are not being sold through WooTickets?

Home Forums Ticket Products Event Tickets Plus Conditional statement when tickets are not being sold through WooTickets?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #953873
    designstudio
    Participant

    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.

    #953907
    Barry
    Member

    Hi 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?

    #954064
    designstudio
    Participant

    Hi Barry,

    Sounds like that will work. How would I get the product id?

    Andy

    #954112
    Barry
    Member

    It’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.

    #954145
    designstudio
    Participant

    Hello 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,
    Andy

    #954148
    Barry
    Member

    Awesome, glad you’re all sorted here 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Conditional statement when tickets are not being sold through WooTickets?’ is closed to new replies.