mandatory attendee information field evasion-enabling bug

Home Forums Ticket Products Event Tickets Plus mandatory attendee information field evasion-enabling bug

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1093623
    Benjamin Roe
    Participant

    I have some events that collect attendee information that has been marked as “required”, but some people are still managing to evade entering this required information. I believe I’ve discovered how one person did it, and have a theory on the second. The first person managed to buy two tickets but only enter the required information for one of those tickets. My belief is that he added one ticket to his cart, then went into his cart and manually adjusted the quantity of tickets to two. The second person managed to buy a single ticket without entering any information. My only theory there is that he added a single ticket and entered the required information, then went into his cart and manually adjusted the quantity of tickets to two, and finally readjusted the quantity of tickets back down to one, with Woocommerce (for whatever reason) choosing the keep the ticket with no information attached. Please help! My site relies on this collection of information to operate properly.

    #1094178
    Nico
    Member

    Hi there Benjamin,

    Thanks for reaching out to us on this. You raise an interesting point!

    I guess this is not a bug but more a limitation on how Ateendees Meta works. If having the attendee meta data is mandatory for your customers to purchase the tickets, then maybe you can explore the option of not showing quantity selector in the cart screen?

    I’ll create a ticket to review this, but I’m not sure if this will be considered as a bug that needs to be fixed asap.

    Please let me know what you think about this,
    Best,
    Nico

    #1094818
    Dan Feeley
    Participant

    @Nico,

    I’m not sure about the OP but your solution doesn’t sound too bad to me. I know WooCommerce Bookings does the same thing and only displays the quantity in the cart.

    I tried searching (with no luck). Do you know how to remove the quantity selector of the event in the cart?

    #1094918
    Nico
    Member

    Hey Dan,

    Thanks for following up on this! I’m not an expert in Woo myself, I guess the best would be to do a template override of the cart template (https://docs.woothemes.com/document/template-structure/) and check for each product if they are in a category or have a certain tag, and if that’s the case then prevent the quantity selector to be printed on the page.

    If you want to hide it for all products because you only sell tickets, then adding a CSS snippet could be simpler approach.

    Sorry not to be of much help on this one,
    Best,
    Nico

    #1098361
    Dan Feeley
    Participant

    @Nico,

    I found a way to lock down particular items in the cart based on the fieldset meta. I wanted to post it here in case @Benjamin or anyone else would be interested. I am not a developer, so if you see anything completely off please let me know. Here are two snippets, you only need one of them in your functions.php.

    The first snippet will lock down an item if the ticket contains fieldset meta (required or not).

    
    <?php
    
    	function mse_wc_cart_item_quantity( $product_quantity, $cart_item_key, $cart_item ){
    		$product_id = $cart_item['product_id'];
    		$ticket_meta = get_post_meta( $product_id );
    		if ( isset($ticket_meta['_tribe_tickets_meta_enabled']) && $ticket_meta['_tribe_tickets_meta_enabled'][0] == 1 ) {
    			if ($ticket_meta['_tribe_tickets_meta_enabled']) {
    				$cart_item = WC()->cart->cart_contents[ $cart_item_key ];
    				$product_quantity = $cart_item['quantity'];
    			}
    		}
    		return $product_quantity;
    	}
    
    	add_filter( 'woocommerce_cart_item_quantity', 'mse_wc_cart_item_quantity', 10, 3 );
    

    This second snippet only locks down the cart item if the fieldset meta is “required”.

    
    <?php
    	function mse_wc_cart_item_quantity( $product_quantity, $cart_item_key, $cart_item ){
    		$product_id = $cart_item['product_id'];
    		$ticket_meta = get_post_meta( $product_id );
    		if ( isset($ticket_meta['_tribe_tickets_meta_enabled']) && $ticket_meta['_tribe_tickets_meta_enabled'][0] == 1 ) {
    			$tribe_tickets_meta = unserialize($ticket_meta['_tribe_tickets_meta'][0]);
    			$ticket_meta_required = $tribe_tickets_meta[0]['required'];
    			if ($ticket_meta_required == "on") {
    				$cart_item = WC()->cart->cart_contents[ $cart_item_key ];
    				$product_quantity = $cart_item['quantity'];
    			}
    		}
    		return $product_quantity;
    	}
    
    	add_filter( 'woocommerce_cart_item_quantity', 'mse_wc_cart_item_quantity', 10, 3 );
    
    #1098626
    Nico
    Member

    Hey @danfeeley,

    Wow! Thanks for taking the time to share the scripts 🙂

    At first sight the code seems to be fine and if it works, I guess it’s a solution that might be useful for others o at least a starting point to create their own customizations based on their particular needs!


    @redcapscorner
    , please take a look and even we cannot support this, maybe @danfeeley can help you setting this up.

    Thanks once again @danfeeley,
    Best,
    Nico

    #1098908
    Dan Feeley
    Participant

    @Nico,

    My apologies for the re-post but I was poking around the forums this morning and came across a post from George with a method for retrieving just the ticket fieldset meta. Using this method allowed me to simplify the functions so I wanted to share the new ones in case someone wanted to use them.

    Same as before, first function just looks for fieldset meta being enabled and the second function looks for the meta being required.

    
    <?php
    
    	function mse_wc_cart_item_quantity( $product_quantity, $cart_item_key, $cart_item ){
    		$product_id = $cart_item['product_id'];
    		$ticket_meta = Tribe__Tickets_Plus__Main::instance()->meta()->get_meta_fields_by_ticket( $product_id );
    		
    		if ( !empty($ticket_meta) ) {
    			$cart_item = WC()->cart->cart_contents[ $cart_item_key ];
    			$product_quantity = $cart_item['quantity'];
    		}
    		return $product_quantity;
    	}
    
    	add_filter( 'woocommerce_cart_item_quantity', 'mse_wc_cart_item_quantity', 10, 3 );
    
    
    <?php
    
    	function mse_wc_cart_item_quantity( $product_quantity, $cart_item_key, $cart_item ){
    		$product_id = $cart_item['product_id'];
    		$ticket_meta = Tribe__Tickets_Plus__Main::instance()->meta()->get_meta_fields_by_ticket( $product_id );
    		
    		if ( !empty($ticket_meta) && $ticket_meta[0]->required == "on" ) {
    			$cart_item = WC()->cart->cart_contents[ $cart_item_key ];
    			$product_quantity = $cart_item['quantity'];
    		}
    		return $product_quantity;
    	}
    
    	add_filter( 'woocommerce_cart_item_quantity', 'mse_wc_cart_item_quantity', 10, 3 );
    
    #1099174
    Nico
    Member

    You are a champ @danfeeley !

    Thanks for the update… let’s see if this helps Benjamin as well!

    Thanks once again for the awesomeness 😉

    Cheers,
    Nico

    #1105465
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘mandatory attendee information field evasion-enabling bug’ is closed to new replies.