Fieldset information on order

Home Forums Ticket Products Event Tickets Plus Fieldset information on order

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1096837
    Nick
    Participant

    I use a fieldset to gather attendee information, and this info appears properly on the events attendee list and the emailed tickets to the purchaser.

    However, I also want this info to appear on the confirmed woo order and the emailed order confirmation.

    I am using add_action(‘woocommerce_order_item_meta_end’, ‘list_attendees’,30, 3 ); with a function ‘list_attendees’ defined.

    If I print_r from this function it works, so the action is firing properly.

    It appears that the info this function is using is from the order post (in my case, eg post #680), but the ticket is a separate post, eg post #683. The fieldset data is on the ticket post meta, not the order post meta.

    I can’t find the ticket postid anywhere in the order post, so I can’t lookup the meta data.

    Any clues? I have looked at your /render/meta.php and that hasn’t helped!

    Cheers

    #1097782
    George
    Participant

    Hey Nick,

    Thanks for reaching out! We unfortunately cannot help with custom coding or questions related to such projects. Check out this page for more information → https://theeventscalendar.com/knowledgebase/what-support-is-provided-for-license-holders/


    While that disclaimer is true and we can only provide very limited help here, I would like to at least try and help. 🙂 I think a huge help here would be to first get a good text editor if you don’t have one already. Something like “Sublime Text”, for example. We’ll come back to this later.

    For getting the order items (i.e. tickets) from an order, you could use code like this:


    $order = new WC_Order( $order_id );
    $order_items = $order->get_items();

    That variable $order_items should now be an array of, well, the Order’s items, where you could then use a foreach loop like this:


    if ( is_array( $order_items ) && ! empty( $order_items ) ) {

    foreach ( $order_items as $order_item ) {

    // Do stuff....
    }
    }

    In that part that says “//Do stuff”, you’ll have to take the reins from here. But you should be able to var_dump() the $order_item to find the ID of that item, then you can use the WordPress core function get_post_meta() to find that item’s meta information—not the order’s meta, but that specific item’s meta.

    Now, earlier I mentioned a good text editor—if you don’t have one already, and sorry if you do!—because we will unfortunately not be able to provide much more insight on topics like this. But with a good text order, you can use a “Find in folder” feature to search within the Event Tickets Plus folder for strings like new WC_Order to see where we use the sort of code I describe above. Then you can read how we do things, like getting/setting ticket information, and you can just copy and paste whole chunks of utility from there.

    I hope this information helps! Head to the trusty old Google for anything you’re not familiar with here, check out that support policy page I linked to so that we can operate with the same expectations here, and let me know if you have any further questions that I can help with. 🙂

    Sincerely,
    George

    #1097894
    Nick
    Participant

    Thanks for this, it has set me off in the right direction, but the meta data I require is from the tribe_wooticket post associated with the shop_order post, not the ticket post

    #1097904
    George
    Participant

    Hey Nick,

    I don’t quite understand the distinction you’re making there between those things. Can you clarify?

    In any case, as I mentioned above we unfortunately cannot help with custom coding projects. I’m sorry about this! But at bottom, if you need to do some custom coding and aren’t familiar with sussing out these sorts of inner-workings details, your best bet is to hire a professional to help out.

    We maintain a list of great developers here → http://m.tri.be/18k1 (and have no affiliation with any of these folks—they’re simply some well-respected names in the community that we’ve compiled to share in situations like this one).

    Let me know what you mean about a “tribe_wooticket post” being different from a “ticket post” and I will do my best to offer one last bit of advice here!

    Thank you,
    George

    #1097915
    Nick
    Participant

    Thanks.

    What is the post_type that the fieldset data (for each attendee, not the data definition) is stored on in the meta?
    It doesn’t appear to be in the shop_order post_type.
    And how do I find that post given the order number and the line-item?

    #1098642
    George
    Participant

    Hey Nick,

    The fieldsets are their own post type. This is post type is ticket-meta-fieldset by default.

    To get the DATA, however, all you need is the “Product” ID of the actual ticket.

    You can then use this method, where $product_id is the Product ID:

    $meta = Tribe__Tickets_Plus__Main::instance()->meta()->get_meta_fields_by_ticket( $product_id );

    How do you get a Product ID? Lots of ways; it all depends on your project and your custom coding and where you need that code.

    I would recommend opening up a code editor and finding this class inside your Event Tickets Plus files:

    Tribe__Tickets_Plus__Meta__Render

    Read through that, tinker a bit, back-engineer it—it’s all there and you can learn a lot.

    I will now be closing this thread because we cannot help with code and code customization projects.

    If you need to do some custom coding and aren’t familiar with sussing out these sorts of inner-workings details, your best bet is to hire a professional to help out.

    I wish you the best of luck with your custom designing and building.

    Cheers,
    George

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Fieldset information on order’ is closed to new replies.