Skip to content

Instantly share code, notes, and snippets.

@cliffordp
cliffordp / functions.php
Last active February 6, 2022 13:26
Event Tickets Plus v4.6+: Assign all WooCommerce Tickets to a specific Product Category upon saving (create or update, won't affect old tickets).
<?php
/*
* Event Tickets Plus v4.6+: Assign all WooCommerce Tickets to a specific
* Product Category upon saving (create or update, won't affect old tickets).
*
* !!! YOU NEED TO CHANGE THE CODE TO BE THE PRODUCT CATEGORY ID(S) YOU WANT !!!
*
* @link https://gist.github.com/cliffordp/5bffd372db4ebf14482574ce9bb2479c This snippet.
* @link https://gist.github.com/cliffordp/63abddea69b60f616c1aec1c6bdfc299 Another snippet you might be interested in.
@cliffordp
cliffordp / functions.php
Last active February 15, 2022 22:35
Event Tickets Plus v4.6+ - WooCommerce Tickets: Keep all but the lowest-priced WooTicket for each event as Hidden visibility. Change the least-expensive to Visible (Shop and search results). Filter Visible tickets to have a post title of "Tickets for {Event_Name}" while in Shop or Search.
<?php
/*
* Event Tickets Plus v4.6+ - WooCommerce Tickets: Keep all but the lowest-priced
* WooTicket for each event as Hidden visibility. Change the least-expensive to
* Visible (Shop and search results).
*
* This snippet only works with WooCommerce 3.0.0+.
* We could do the same logic on a different action, like when a ticket is
* deleted or an attendee is created / ticket is sold, but this probably isn't
@theeventscalendar
theeventscalendar / ticketsplus_woocommerce-products.php
Last active February 15, 2022 22:38 — forked from elimn/tribe_wootix_no_hijack.php
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 );