Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save theeventscalendar/180aac35016f667d5d51 to your computer and use it in GitHub Desktop.
Save theeventscalendar/180aac35016f667d5d51 to your computer and use it in GitHub Desktop.
Allows customers to access the WooCommerce product page for tickets with Tickets Plus
<?php
/*
* Causes WooCommerce Ticket product pages to stop redirecting to their event page
* See https://theeventscalendar.com/knowledgebase/selling-tickets-from-the-woocommerce-products-page/
*/
function tribe_wootix_no_hijack() {
if ( ! class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) return;
$woo_tickets = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();
remove_filter( 'post_type_link', array( $woo_tickets, 'hijack_ticket_link' ), 10, 4 );
}
add_action( 'init', 'tribe_wootix_no_hijack' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment