Home › Forums › Ticket Products › Event Tickets Plus › Auto completing tickets
- This topic has 7 replies, 5 voices, and was last updated 8 years, 9 months ago by Support Droid.
-
AuthorPosts
-
March 31, 2015 at 4:27 pm #952407adambowieParticipant
Hey guys – We modified an old site in the past to autocomplete the tickets, so they are processed immediately when someone makes a purchase.
Barry had told us how, but when I find that old support ticket, the link he gave me no longer works.
Can someone tell me how to do it?
I found another solution online: http://clicknathan.com/web-design/customizing-wootickets-for-events-calendar/
and we tried it, but I think it no longer works because of the way Woocommerce started processing orders in 3.2.Appreciate the help!
April 2, 2015 at 11:34 am #952877Gustavo BordoniKeymasterHi Adam,
Thanks for reaching out to us here on our support forums.
Can you link me which was the solution that Barry provided you? Then I can try it locally and see why it’s not working anymore.
my Best Regards,
April 2, 2015 at 12:55 pm #952904James O’SullivanParticipantGive this snippet here a try in your functions.php file. What it does is auto complete a transaction for a virtual product in woocommerce and tickets are virtual products so should work well here. Let me know if it helps.
// Automatically complete orders of virtual products only add_filter( 'woocommerce_payment_complete_order_status', 'virtual_order_payment_complete_order_status', 10, 2 ); function virtual_order_payment_complete_order_status( $order_status, $order_id ) { $order = new WC_Order( $order_id ); if ( 'processing' == $order_status && ( 'on-hold' == $order->status || 'pending' == $order->status || 'failed' == $order->status ) ) { $virtual_order = null; if ( count( $order->get_items() ) > 0 ) { foreach( $order->get_items() as $item ) { if ( 'line_item' == $item['type'] ) { $_product = $order->get_product_from_item( $item ); if ( ! $_product->is_virtual() ) { // once we've found one non-virtual product we know we're done, break out of the loop $virtual_order = false; break; } else { $virtual_order = true; } } } } // virtual order, mark as completed if ( $virtual_order ) { return 'completed'; } } // non-virtual order, return original status return $order_status; }
April 7, 2015 at 6:50 am #953686niggoParticipantThe plugin “WooCommerce – Autocomplete Order” does exactly what you want.
April 7, 2015 at 7:07 am #953688Gustavo BordoniKeymasterI’ve tested Niggo’s solution on my LocalHost and It does solve this problem. Adam, can you check if that solves your issue?
My best Regards,
April 7, 2015 at 10:41 am #953783adambowieParticipantThanks guys. I tried installing Woocommerce Autocomplete Orders but it did not work – although it may be because I am running 4.1.
I will test Niggo’s solution now and update the thread once I do. Thank you both!
April 21, 2015 at 10:16 pm #957246Gustavo BordoniKeymasterHi Adam,
Do you have any news on the Niggo’s solution? If you don’t let me know and we can try to wrap this issue.
My Best Regards,
July 7, 2015 at 6:31 am #984056Support DroidKeymasterThis 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. -
AuthorPosts
- The topic ‘Auto completing tickets’ is closed to new replies.