Home › Forums › Ticket Products › Event Tickets Plus › Disable Virtual Product
- This topic has 10 replies, 3 voices, and was last updated 10 years ago by
George.
-
AuthorPosts
-
March 20, 2016 at 12:21 pm #1091575
stagetech
ParticipantI’m using Events Calendar Pro with Event Tickets Plus and WooCommerce.
My client’s plan has changed a little and they are now going to be selling physical tickets only. I’ve disabled the tickets email with:
// Remove ticket emails add_action( 'init', 'wootickets_stop_sending_email' ); function wootickets_stop_sending_email() { if (class_exists('Tribe__Tickets_Plus__Commerce__WooCommerce__Main')) { $woo = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(); remove_filter( 'woocommerce_email_classes', array( $woo, 'add_email_class_to_woocommerce' ) ); add_action( 'woocommerce_email_after_order_table', array( $woo, 'add_tickets_msg_to_email' ) ); } } // Remove the line about tickets in order emails add_filter('wootickets_email_message', 'woo_tickets_filter_completed_order', 10 ); function woo_tickets_filter_completed_order($text) { $text = ""; return $text; }I need to be able to switch off the “virtual product” setting when each ticket product is created with something like
update_post_meta( $ticket->ID, '_virtual', 'no' );but what I’ve tried so far isn’t working. Any ideas?March 20, 2016 at 3:31 pm #1091605George
ParticipantHi there,
We unfortunately cannot help with custom coding projects, but out of curiosity, can you clarify the goal of setting tickets as NOT being virtual products?
Their status as virtual products is quite essential to the concept of what these tickets are—they are virtual products. Whether you end up printing out tickets or not, the actual “product” being sold is the ticket on the website (a “slot” on the attendees list, essentially).
Is there anything about the Virtual Product setting specifically that hinders the choice to sell physical tickets? Our plugins only work with the tickets as Virtual Products.
Let me know what you think of all of this and if you can elaborate a bit on your aims—while we cannot help with customizations, if I better understand your goals I might be able to help write a snippet of code to help.
Thank you!
GeorgeMarch 20, 2016 at 5:37 pm #1091621stagetech
ParticipantHi George,
Thanks for the reply.
My intention with making it a non-virtual product was to return the shipping options and address fields to the checkout process for tickets. If you’re able to suggest how I might do that without changing the virtual product status, that would be awesome!
March 21, 2016 at 2:43 pm #1092047George
ParticipantTo the best of my knowledge, @stagetech, there is no way to pull that off. 🙁 I’m sorry about this, but will take a deeper dive into the code here to just how possible this is! I will rope in a more skilled developer to assist me, too.
Stay tuned—and thank you for your patience!
George
March 21, 2016 at 4:00 pm #1092096stagetech
ParticipantThanks George, much appreciated!
March 23, 2016 at 5:09 pm #1093216stagetech
ParticipantI’ve been able to get shipping methods back with
add_filter( 'woocommerce_cart_needs_shipping', '__return_true' );but this forces shipping on all products, including some other virtual products that I don’t need shipping for. I’ve tried a few things to exclude those products but not having much luck!Any progress on your end?
March 24, 2016 at 11:28 am #1093593George
ParticipantThere’s unfortunately no progress on my end, @stagetech—I’m sorry for the delayed response, but have been tinkering a bit to no avail. Your solution is a solid one, despite it affecting all other products….
I’m sorry to disappoint @stagetech! I think from here your best bet is to reach out to WooCommerce-specific support folks: “How can I add shipping to some Virtual Products, but not all?”
I’ve been unsuccessful in trying to do this. Sorry, @stagetech! 🙁
— George
March 24, 2016 at 2:26 pm #1093683stagetech
ParticipantThanks for the update George, and thank you for trying. If I have a breakthrough at some point I’ll let you know!
March 24, 2016 at 3:10 pm #1093702George
ParticipantThank you @stagetech—much appreciated. I will close this specific thread for now to help keep issues organized, but if you have a breakthrough and want to share it—or have questions about anything else!—don’t hesitate to open a new thread any time.
Thank you!
GeorgeApril 1, 2016 at 3:00 am #1096831James
ParticipantI’m doing something very similar, except my client wants the option for virtual and physical tickets.
My plan is to try and stop making tickets virtual, and then only send the email if they select the virtual delivery method (I have no idea if this is possible yet, some of your code might help).
I tried using the update post meta, with a post transition hook, but it turned out the was something firing after the hook setting the ticket back to being virtual.
Anyway, I’ve found that this works:
/** * Stop tickets being virtual */ function make_ticket_physical($post_ID, $post_after, $post_before){ if($post_after->post_type == 'product'){ update_post_meta( $post_ID, '_virtual', 'no'); } } add_action( 'save_post', 'make_ticket_physical', 999999999999999999999, 3 );Edit: You don’t actually need $post_before
Now i’ve got to try and work out how to only send the ticket email if they’ve chosen virtual delivery…
-
This reply was modified 10 years ago by
James.
April 1, 2016 at 2:28 pm #1097241George
ParticipantThank you for sharing this, @James!
-
This reply was modified 10 years ago by
-
AuthorPosts
- The topic ‘Disable Virtual Product’ is closed to new replies.
