Custom ticket fields – Attendee information

Home Forums Ticket Products Event Tickets Plus Custom ticket fields – Attendee information

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #1142009
    Michael Shelton
    Participant

    How does one access the information stored in the attendee fields? I’m trying to trigger a discount based on the response to attendee questions and I’m not sure where these get stored are they custom fields or meta or what?

    Any help in pointing me to the right direction would be great.

    Thanks in advance.

    #1142248
    Josh
    Participant

    Hey Michael,

    Thanks for reaching out to us!

    To clarify here, are you referring to accessing the values from the Ticket Fieldset responses provided by a user when purchasing a ticket?

    Thanks!

    #1142263
    Michael Shelton
    Participant

    Yes Josh, that’s exactly what I’m talking about 🙂

    I wanted to have a radio button that if checked, I could discount the price of the ticket. This seemed like an easy way to apply an optional discount on a single ticket without disrupting the ticket count. Has this been done other ways or have you seen an easier way? I’m open at this point.

    #1142795
    Josh
    Participant

    Hey Michael,

    Thanks for following up here!

    You should be able to grab that information from the form data (wouldn’t be stored anywhere directly at this point in the checkout process) when a ticket is added to the cart, however there would be several layers of customization there to grab the information and then compare and apply the discount that we wouldn’t be able to provide support for here in these forums.

    Alternatively though, you could take advantage of the Global Stock feature here that should alleviate the ticket count issue you mention above.

    Let me know if this helps.

    Thanks!

    #1144860
    Michael Shelton
    Participant

    Josh, thank you for this, I saw the global stock feature and assumed I knew what it did without reading it 🙂 Shocking I know.

    As a follow up. If I add a field as part of the “Ticket Fieldset” is there a way to include a brief description (sentence) in addition to the label for the input field? I figured I could put it in the event description but that ends up being too far away to help inform users of the significance of the field.

    This article https://theeventscalendar.com/knowledgebase/collecting-attendee-information/ doesn’t expand on this much so I figured I’d ask… Thanks for all of the love and support.

    #1145531
    Josh
    Participant

    Hey Michael,

    Thanks for following up here!

    Unfortunately it doesn’t look like there is a simple way to add a description without some code customizations here.

    To help get you pointed in the right direction here, are you planning on having multiple descriptions, multiple fields within a fieldset, or multiple fieldsets throughout the site?

    Thanks!

    #1145815
    Michael Shelton
    Participant

    Hi Josh,

    I just need one field and a description, and I want to use it on each event. There will be 5 events, each week and they are identical besides the date changes.

    Thanks

    #1145818
    Michael Shelton
    Participant

    Sorry let me re-explain that.

    We have 4 types of tickets.

    Student/Military discount tickets and general admission are first come first serve and we have a total of 140, I used the global stock feature to account for those and this is working delightfully.

    Next we have Tier 2 and Tier 1 each have their own number of total stock so these are independent, they differ in price as well. On these fields we allow people to add a “Group Name” so we can rope off sections of tier 2 or tier 1 seats to accommodate larger groups.

    So every event, we have 2 ticket types that need the same single input field that simply asks if folks have a group name to associate with their order. We wanted to add this line of description next to “Group name? (optional)
    If purchasing tickets separately, please provide a group name. Any reservations in the same tier using matching group names will be seated together.

    Thanks for the help!

    #1146053
    Josh
    Participant

    Hey Michael,

    Thanks for following up here and clarifying!

    Since the description will be the same anytime that you’re using the ticket fieldset feature, you can follow our Themer’s Guide to copy the template from the Event Tickets Plus plugin at src > views > meta.php into your theme. From there, you can add the description where you would like to display within that section.

    Let me know if this helps.

    Thanks!

    #1146217
    Jayson Cote
    Participant

    @esthers525 If you’re interested, I have a code snippet here that will allow you to extract the ticket fieldset field data submitted with each ticket.

    You will need to edit the field slug names to match your own field names, which you can see in the code identified between single quotes and square brackets. You will also need to get the order ID to return the correct values for that order. Depending on your planned usage there are several techniques to get the order ID and then hook or filter into the correct action in order to display or … with the ticket meta data.

    The code below adds the ticket field values to the woocommerce customer email notice, although you can use the $fieldset_meta to get the values and do whatever you wish with them. Hope this helps.

    //** Add fields to order emails - customer
    //add_action( 'woocommerce_email_customer_details', 'gum_woo_checkout_fields_email_customer' );
    function gum_woo_checkout_fields_email_customer( $order ) {
    	  
    	$fieldset_meta = get_post_meta( $order->id, Tribe__Tickets_Plus__Meta::META_KEY, true );
    	$cnt = 1;
    	
    	if (! $fieldset_meta ) return;
    
    	echo '<h3> Course Participants </h3>';
    	
    	foreach( $fieldset_meta AS $item => $value ) {
    		
    		foreach( $fieldset_meta[$item] AS $key => $value ) {
    				
    				$att_fname 		= (isset( $value['first-name'] )) ? $value['first-name'] : '';
    				$att_lname 		= (isset( $value['last-name'] )) ? $value['last-name'] : '';
    				$att_email 		= (isset( $value['email'] )) ? $value['email'] : '';
    				$att_phone 		= (isset( $value['phone'] )) ? $value['[phone'] : '';
    				$att_profession = (isset( $value['profession'] )) ? $value['profession'] : '';
    				$att_license 	= (isset( $value['license'] )) ? $value['license'] : '';
    				
    				echo '<p>';
    				echo '<strong>Attendee - '. $cnt .'</strong><br />';
    				echo 'Name: '. $att_fname .' '. $att_lname .'<br />';
    				echo 'Email: '. $att_email .'<br />';
    				echo 'Phone: '. $att_phone .'<br />';
    				echo 'Profession: '. $att_profession .'<br />';
    				echo 'License #: '. $att_license .'<br />';
    				echo '</p>';
    			
    			$cnt++;
    			
    			
    		}
    		
    	}
    }
    #1146502
    Josh
    Participant

    Hey Jayson,

    Thanks for adding that information here! Looks like it could be very helpful!

    Thanks!

    #1150159
    Gergana
    Participant

    Hello All,

    I will join in this thread with little different question. How can I include the custom ticket fields into the ticket and the order information in the administration console?
    I have tried to include the given snippet by @gumwp into my theme function.php but at the end it gives me “Internal server error” when I am finalizing the purchase. I need to include this information because the event will offer a ticket for 2 persons. I am using the custom ticket fields for requesting information for the second person, but I cannot find the information from the custom fields usable. Could you please advise me how this can be done.

    @gumwpCould you please advise me where to include your snippet code in order to be working as you wrote 2 posts above in the thread.
    Thank you for your time : )

    #1150788
    Josh
    Participant

    Hey Gergana,

    Thanks for following up here. We typically request for additional requests that vary from the original post to open a new thread. However, I’ll leave this open in case there is any additional feedback.

    However, snippets like this should be placed in your theme’s functions.php file. Sometimes, based on the configuration on the file, some people do find some difficulty in applying the snippets to their theme. If so, you can also try using a plugin like https://wordpress.org/plugins/code-snippets/ for adding those snippets.

    Thanks!

    #1151670
    Jayson Cote
    Participant

    @gergana I have updated the snippet for you. Simply place in your child theme functions.php file. FYI you will need to update the field slug names to be the same as the fields that you have created. The field slug name are indicated between the square brackets within the single quotation marks, i.e. [‘first-name’]

    //** Display TEC ticket meta field value on the order admin page
    add_action( 'woocommerce_order_details_after_customer_details', 'gum_woo_ticket_fields_display_admin', 10, 1 );
    function gum_woo_ticket_fields_display_admin( $order ) {
    	
    	// TEC ticket meta fields - get data
    	$fieldset_meta = get_post_meta( $order->id, Tribe__Tickets_Plus__Meta::META_KEY, true );
    	
    	//If No fields set, do not process
    	if (! $fieldset_meta ) return;
    	
    	//If fields set, loop and display each tickets data
    	for($i = 0; $i < count($fieldset_meta); $i++) {
    		
    		$att_ticket_title = get_the_title($keys[$i]);
    		echo '<h4>'. $att_ticket_title .'</h4>';
    		
    		foreach( $fieldset_meta[$keys[$i]] AS $key => $value ) {
    				
    			$att_fname 		= (isset( $value['first-name'] )) ? $value['first-name'] : '';
    			$att_lname 		= (isset( $value['last-name'] )) ? $value['last-name'] : '';
    			$att_email 		= (isset( $value['email'] )) ? $value['email'] : 'this';
    			$att_phone 		= (isset( $value['phone'] )) ? $value['phone'] : '';
    			$att_profession = (isset( $value['profession'] )) ? $value['profession'] : '';
    			$att_license 	= (isset( $value['license'] )) ? $value['license'] : '';
    
    			echo '<p>';
    			echo '<strong>Attendee - '. ($key + 1) .'</strong><br />';
    			echo 'Name: '. $att_fname .' '. $att_lname .'<br />';
    			echo 'Email: '. $att_email .'<br />';
    			echo 'Phone: '. $att_phone .'<br />';
    			echo 'Profession: '. $att_profession .'<br />';
    			echo 'License #: '. $att_license .'<br />';
    			echo '</p>';
    			
    		} //end foreach
    		
    	} //end for
    	
    } // end function
    #1151863
    Gergana
    Participant

    Thank you Jayson,

    This work great!. Now I have the attendee additional information in the tickets. I have one additional question: what do you mean by: “Display TEC ticket meta field value on the order admin page” Is that means it can be shown inside the order details or not?

Viewing 15 posts - 1 through 15 (of 17 total)
  • The topic ‘Custom ticket fields – Attendee information’ is closed to new replies.