Home › Forums › Ticket Products › Event Tickets Plus › How do I skip the View Cart phase (to sidestep missing attendee info bugs)
- This topic has 12 replies, 7 voices, and was last updated 9 years, 4 months ago by
Mike.
-
AuthorPosts
-
November 16, 2016 at 7:45 pm #1193662
Mike
ParticipantThe suggested patch by Modern Tribe support to the possibility of customers adding (or removing) tickets during the “view cart” phase in woocommerce is to prevent the ability to modify the cart contents during this stage. While this DOES work in closing the loop hole that side steps the Attendee Info event collection funnel, it basically makes the view cart phase completely redundant. In other words, if the user can’t alter their cart contents, it serves no purpose to display the view cart page at all. The only other feature on the page is the ability to add Coupons, which can also be added in checkout phase.
Would it be possible to skip the view cart phase entirely, taking customers directly to the check out phase after they have selected their tickets and inputed their attendee info? This would be a superior patch to the existing one, as it would remove a needless phase of the checkout process .
There are functions out there that do this for Woocommerce, but none of the ones I have tried work from “Add to Cart” buttons on the Event Pages.
On a related note, I would like to state that the actual FIX for this problem is to move the collection of Attendee Info to the “view cart” (ideal for every implementation I can think of) or “checkout” phase (less options, but would work 100% of the time in making sure all attendee info is collected).
View Cart Attendee Info
Moving it here would allow customers to alter their purchase, adding or removing tickets, but still require them to complete all attendee info before progressing to the checkout phase. This provides the most amount of versatility for the customers, as they can edit the order as they see fit until they proceed.Checkout Attendee Info
This is where I currently collect my attendee info in my hacked solution on my live site. It works 100% of the time, because at this stage the user is locked into the purchase in their cart.I would prefer to have it in the view cart phase, as it splits up the data entry into two phases (shorter perceived length of time filling in fields) and allows them versatility.
November 17, 2016 at 8:13 am #1193852Gergana
ParticipantHi Mike,
I want to ask you what how you have succeeded to enter the collection of the attendee data into the checkout page(If I understood you correctly) in this paragraph
Checkout Attendee Info
This is where I currently collect my attendee info in my hacked solution on my live site. It works 100% of the time, because at this stage the user is locked into the purchase in their cart.#At this moment I made a template customization to skip the “Cart” page because there is no need of it(even it makes more harder for the people to buy the tickets – 60% of the clients leave the site after jumping into the cart).
But I am interested how you have succeded to include the attendee fields into the checkout.
November 17, 2016 at 2:38 pm #1194162Cliff
MemberHi again, Mike.
Great idea.
Here’s a snippet for you:
https://gist.github.com/cliffordp/f148a9cacd726e5a86ffeda2d2e204c1
Let me know what you think about it.
Your other points raised about being smarter with the attendee information is definitely valid. Let’s keep discussion regarding that in your other thread, here.
November 17, 2016 at 11:33 pm #1194335Mike
ParticipantThanks for the code snippet, but unfortunately it doesn’t work. I’ve tried in base theme 2015 and deactivating all plugins except for:
- Event Tickets
- Event Tickets Extension: Additional Email Options
- Event Tickets Plus
- The Events Calendar
- The Events Calendar PRO
- The Events Calendar: Filter Bar
- WooCommerce
Any ideas?
November 18, 2016 at 9:18 am #1194575Cliff
MemberIt worked for me with Twenty Sixteen and WooCommerce v2.6.8
Does your /wp-content/plugins/woocommerce/templates/cart/cart.php file have this as Line 25?
do_action( 'woocommerce_before_cart' ); ?>November 19, 2016 at 5:45 am #1194833Kymiel Standifer
ParticipantI am experiencing the same issues and would like a workaround or fix for this issue. I am not as programming savvy as the other user but I can follow clear directions.
The biggest issues with this plugin are
1) Can see the attendee fields in the cart, checkout, confirmation email to attendees2 Can’t update cart properly if user decides to press the back button after selecting Ticket option and the information previously entered is lost. Agreed should go straight to checkout or provide better functionality. Converting to read only doesn’t provide a viable solution.
Since converting to read only is my only option at this time can you please provide clarity on where these snippets go
November 19, 2016 at 6:33 am #1194843Mike
Participant@ Cliff – Yes, it does. I will try testing some more tomorrow, but I was pretty thorough the first time.
@Kymiel – Put it in your Functions.php file inside of your themes folder, which should be a CHILD THEME. You should never alter your core theme (this preserves code snippets like this during theme upgrades). The structure should be something like /*your_server*/public_html/*wordpress_directory*/wp-content/themes/*your_theme*/functions.php
The *entries_like_this* will have your own info. For example, if your server is named server1, your wordpress is installed in your root directory, and your theme is named AwesomeTownTheme, then it should be something like:
/server1/public_html/wp-content/themes/AwesomeTownTheme-child/functions.php
Note: the wordpress directory was omitted, as the sample above was installed in the root directory. Also note that it listed the theme directory as AwesomeTownTheme-child, instead of AwesomeTownTheme.
If you don’t know what a child theme is, read up on that first. It’s easy to setup and will save you ass, trust me. Random Child Theme Tutorial If you don’t like that Tutorial, do a google search. There are tons of them.
November 21, 2016 at 2:48 pm #1195543Mike
ParticipantConfirmed that the provided snippet is non operational.
I installed 2016, deactivated all plugins, added the code the functions.php file. On filling in attendee info and clicking “add to cart”, I am forwarded to the “view cart” page, not “checkout”.
This is with a clean theme, no customization beyond the included snippet.
Activated Plugins:
Advanced Post Manager
Event Tickets
Event Tickets Plus
The Events Calendar
The Events Calendar PRO
The Events Calendar: Filter Bar
WooCommerceAny ideas?
November 21, 2016 at 11:59 pm #1195659Kymiel Standifer
ParticipantThanks Mike I will try once I return from vacation after the holidays!
November 22, 2016 at 12:02 am #1195660Gergana
ParticipantHi Mike,
I can offer my solution here. It is working for me. It consist only /wootickets/tickets.php override. I am providing you modification:
<?php /** * Renders the WooCommerce tickets table/form * * @version 4.3.2 * * @var bool $global_stock_enabled * @var bool $must_login */ global $woocommerce; $checkout_url = $woocommerce->cart->get_checkout_url(); $is_there_any_product = false; $is_there_any_product_to_sell = false; $unavailability_messaging = is_callable( array( $this, 'do_not_show_tickets_unavailable_message' ) ); ob_start(); $start_event_date = tribe_get_start_date( $event_id, true, 'Y-m-d h:i:s' ); if ( !empty($start_event_date = tribe_get_start_date( $event_id, true, 'Y-m-d h:i:s' ) ) ) { echo do_shortcode( '[smartcountdown deadline="' .$start_event_date. '" fx_preset="Sliding_text_fade.xml" digits_style="font-family:Lucida Sans Unicode, Lucida Grande, sans-serif;font-weight:bold;" labels_size="19" title_before_down="Време до Началото" widget_style="text-align:center;" mode="countdown" units="days,hours,minutes,seconds"]' ); } /** * Filter classes on the Cart Form * * @since 4.3.2 * * @param array $cart_classes */ $cart_classes = (array) apply_filters( 'tribe_events_tickets_woo_cart_class', array( 'cart' ) ); ?> <form action="<?php echo esc_url( $checkout_url ) ?>" class="<?php echo implode( ' ', $cart_classes ); ?>" method="post" enctype='multipart/form-data'> <h2 class="tribe-events-tickets-title" style="text-align: center;"><?php esc_html_e( 'Tickets', 'event-tickets-plus' ) ?></h2> <h2 class="tribe-events-tickets-title" style="text-align: center;"><?php esc_html_e( 'За да поръчате своя билет, можете да се обадите на ... или да попълните формата за поръчка по долу.', 'event-tickets-plus' ) ?></h2></ br> <table width="100%" class="tribe-events-tickets"> <?php foreach ( $tickets as $ticket ) { /** * @var Tribe__Tickets__Ticket_Object $ticket * @var WC_Product $product */ global $product; if ( class_exists( 'WC_Product_Simple' ) ) { $product = new WC_Product_Simple( $ticket->ID ); } else { $product = new WC_Product( $ticket->ID ); } if ( $ticket->date_in_range( current_time( 'timestamp' ) ) ) { $is_there_any_product = true; $data_product_id = 'data-product-id="' . esc_attr( $ticket->ID ) . '"'; echo sprintf( '<input type="hidden" name="product_id[]" value="%d">', esc_attr( $ticket->ID ) ); echo '<tr>'; /** * Filter classes on the Price column * * @since 4.3.2 * * @param array $column_classes */ $column_classes = (array) apply_filters( 'tribe_events_tickets_woo_quantity_column_class', array( 'woocommerce' ) ); echo '<td class="' . implode( ' ', $column_classes ) . '" ' . $data_product_id . '>'; if ( $product->is_in_stock() ) { // Max quantity will be left open if backorders allowed, restricted to 1 if the product is // constrained to be sold individually or else set to the available stock quantity $max_quantity = $product->backorders_allowed() ? '' : $product->get_stock_quantity(); $max_quantity = $product->is_sold_individually() ? 1 : $max_quantity; $original_stock = $ticket->original_stock(); // For global stock enabled tickets with a cap, use the cap as the max quantity if ( $global_stock_enabled && Tribe__Tickets__Global_Stock::CAPPED_STOCK_MODE === $ticket->global_stock_mode()) { $max_quantity = $ticket->global_stock_cap(); $original_stock = $ticket->global_stock_cap(); } woocommerce_quantity_input( array( 'input_name' => 'quantity_' . $ticket->ID, 'input_value' => 0, 'min_value' => 0, 'max_value' => $must_login ? 0 : $max_quantity, // Currently WC does not support a 'disable' attribute ) ); $is_there_any_product_to_sell = true; $remaining = $ticket->remaining(); if ( $remaining ) { ?> <span class="tribe-tickets-remaining"> <?php echo sprintf( esc_html__( '%1$s available', 'event-tickets-plus' ), '<span class="available-stock" ' . $data_product_id . '>' . esc_html( $remaining ) . '</span>' ); ?> </span> <?php } do_action( 'wootickets_tickets_after_quantity_input', $ticket, $product ); } else { echo '<span class="tickets_nostock">' . esc_html__( 'Out of stock!', 'event-tickets-plus' ) . '</span>'; } echo '</td>'; echo '<td class="tickets_name">'; echo $ticket->name; echo '</td>'; echo '<td class="tickets_price">'; echo $this->get_price_html( $product ); echo '</td>'; echo '<td class="tickets_description">'; echo $ticket->description; // print the sales end date if it's defined // if ( !empty($ticket->end_date) ) echo '<br>Цената важи до: ' . $ticket->end_date; $ticketenddate = $ticket->end_date; if ( !empty($ticket->end_date) ) { echo do_shortcode( '[smartcountdown deadline="' .$ticketenddate. '" fx_preset="Sliding_text_fade.xml" digits_size="12" labels_size="13" title_before_down="Цената важи до" mode="countdown" units="days,hours,minutes,seconds"]' ); } echo '</td>'; echo '</tr>'; if ( class_exists( 'Tribe__Tickets_Plus__Attendees_List' ) && ! Tribe__Tickets_Plus__Attendees_List::is_hidden_on( get_the_ID() ) ) { echo '<tr class="tribe-tickets-attendees-list-optout">' . '<td colspan="4">' . '<input type="checkbox" name="optout_' . $ticket->ID . '" id="tribe-tickets-attendees-list-optout-woo">' . '<label for="tribe-tickets-attendees-list-optout-woo">' . esc_html__( 'Don\'t list me on the public attendee list', 'event-tickets' ) . '</label>' . '</td>' . '</tr>'; } include Tribe__Tickets_Plus__Main::instance()->get_template_hierarchy( 'meta.php' ); } } if ( $is_there_any_product_to_sell ) { ?> <tr> <td colspan="4" class="woocommerce add-to-cart"> <?php if ( $must_login ): ?> <?php include Tribe__Tickets_Plus__Main::instance()->get_template_hierarchy( 'login-to-purchase' ); ?> <?php else: ?> <button type="submit" name="wootickets_process" value="1" class="button alt"><?php esc_html_e( 'Add to cart', 'event-tickets-plus' );?></button> <?php endif; ?> </td> </tr> <?php } ?> </table> </form> <?php $content = ob_get_clean(); if ( $is_there_any_product ) { echo $content; // @todo remove safeguard in 4.3 or later if ( $unavailability_messaging ) { // If we have rendered tickets there is generally no need to display a 'tickets unavailable' message // for this post $this->do_not_show_tickets_unavailable_message(); } } else { // @todo remove safeguard in 4.3 or later if ( $unavailability_messaging ) { $unavailability_message = $this->get_tickets_unavailable_message( $tickets ); // if there isn't an unavailability message, bail if ( ! $unavailability_message ) { return; } } }The important stuffs here are:
on line 11
$checkout_url = $woocommerce->cart->get_checkout_url();and on line 33
<form action="<?php echo esc_url( $checkout_url ) ?>" class="<?php echo implode( ' ', $cart_classes ); ?>" method="post" enctype='multipart/form-data'>The other customizations are for implementing the Smart Countdown FX into the ticket’s (showing the enddate of the ticket and the start date of the event.
###
Hope this helps!November 29, 2016 at 10:01 am #1199245Brook
ParticipantThank you again Mike for testing that snippet with a base theme. Have you tried Gergana’s solution? It is truly odd that Cliff’s snippet was not working for youand to be up front we have no idea why it wouldn’t. But, Gergana’s solution goes about this a different, yet elegant, way. If you create a theme override as outlined there, does add to cart bypass the cart page?
Just so you guys know we are keenly aware of the need to show ticket info and be able to edit it in the cart. We have listed this as an upcoming feature/request here. If it is something you would like to see us implement, please vote on it. This will not bypass the cart page though. Bypassing the cart page will break WooCommerce for websites which offer products other than just tickets, and will hamper the ability for users to purchase tickets for multiple events at once. So our general solution will not be to bypass the page, but we would like to show the info and allow people to edit it as needed.
Thank you all for sharing your solutions and tips. Please let me know if any of you still need assistance or have open questions that stemmed from the solutions shared. Cheers!
– Brook
December 21, 2016 at 8:35 am #1208883Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘How do I skip the View Cart phase (to sidestep missing attendee info bugs)’ is closed to new replies.
