Custom Fields for Tickets

Home Forums Ticket Products Event Tickets Plus Custom Fields for Tickets

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #966037
    John
    Participant

    Hi there,

    I’m interested in being able to add custom fields to my tickets, but I’m not sure how to go about doing it. Right now, when different tickets to different events are purchased, all of the revenue gained is pooled into one spot. I wanted to be able to add a custom field (“cost_center” or “Cost Ctr#”) that would be different between events, if not between tickets, and would be visible as a column on CSV export so that I could see what revenue should be distributed where from that pool.

    I’m having difficulty finding where fields are defined for tickets, or where the back-end for tickets is being generated so I can manually add a new textarea to be filled out and saved as a property (cost_center) of each ticket in the database. I’ve found code for a custom CSV export to pull down the newly created columns all good and well, but I can’t for the life of me find anything on creating new fields on the back-end for the tickets.

    Any help would be appreciated.

    #966140
    Geoff
    Member

    Hi John,

    Thanks for getting in touch and welcome to the forums!

    I’m afraid there is no simple way to do this (or at least that we would be able to cover here), but you can find the bulk of the TribeEventsTickets class in:

    /plugins/the-events-calendar/lib/tickets/tribe-tickets.php

    You can also find the metabox for tickets in that same directory. I certainly wouldn’t suggest altering core code to craft a solution here, but hopefully this gives you some ammo to work with. Let me know if you have any follow-up questions here and I’d be happy to help as best I can. 🙂

    Cheers!
    Geoff

    #966621
    John
    Participant

    Thank you for your help, Geoff! Your suggestions have helped me a great deal so far, but out of curiosity, are the tickets being saved in any specific way? I’m looking at the meta-box.php document in the-events-calendar/admin-views/tickets/ and I know that this is the spot where I want to add one or more inputs, but I’m not sure how to get the ticket to recognize it as a property so it can be exported as an attribute (column) during CSV export. If I just add an input with an id and name of “cost_center” and a class of “ticket_field”, would the plugin recognize that and add it as a new column on tickets from now on? Or would I need to add some code elsewhere?

    Thank you for your help! I understand that it obviously isn’t exactly preferable to go mucking about in the core files and modifying the functionality of the plugin at its core, but this is a function I needed very badly, and your help in getting me to the end of this is greatly appreciated. 🙂

    #966640
    Geoff
    Member

    Hey John! Thanks for following up. 🙂

    That’s an excellent question. I have to admit that it’s a little over my own head, but I have connected with one of our developers and was able to get a couple of tips to help you on your way here:

    1. Tickets are regular products, so additional ticket-specific data should live as product meta data and WordPress’s standard blog post meta API can be used for capturing that data.
    2. The Events Calendar won’t just accept the extra fields being added. You’ll need to add your own logic, possibly on save_post or similar, to tee that up.

    I hope this helps!

    Geoff

    #966666
    John
    Participant

    Thanks for your quick response, Geoff!

    I understand these tips for the most part, but what I don’t get is how to edit the product metadata of the tickets. I want to do this right, so I’m interested in taking that route, but I’m not sure how to go about it. If I wanted this to be a property of each individual ticket that can be changed on an individual basis in the back-end (preferably in the same spot that we define the time that the ticket will be available), how could I add that additional ticket-specific data? Is there a tutorial I could take a look at? I don’t really understand how to manipulate the tickets as products because every tutorial I’ve seen has been using an interface that my site doesn’t have, so I’m really confused.

    I really appreciate your patience and cooperation, Geoff! 🙂

    #966766
    Geoff
    Member

    Hey there, John!

    I’d love to help out here, but I think we’re beyond the level of support I can provide for a customization. I’m not aware of any tutorials that cover this specific topic, but you’re certainly welcome to check out our documentation for further reference. I’d also suggest heading over to the WooCommerce docs as well.

    Also, just a note that we are always taking new feature requests on our Uservoice page–if you have any specific requests we should look into, please add them there and we’d be happy to check them out. 🙂

    Cheers!
    Geoff

    #969785
    Geoff
    Member

    Hey John–this thread has been quiet for a couple of weeks, so I’m going to go ahead and close it. Please feel free to hit us up with a new thread if you still have any questions here and we’d be happy to help as best we can. 🙂

    Cheers!
    Geoff

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Custom Fields for Tickets’ is closed to new replies.