Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
WooCommerce Box Office - Enable Tickets options on Subscription and Deposit product types
<?php
/*
* This code will enable the 'Tickets' checkbox and options on Subscription and Deposit products.
* Add this to your theme's functions.php file.
*/
//* Remove Filter from BOX OFFICE plugin
add_action( 'admin_init', 'remove_boxoffice_filter' );
function remove_boxoffice_filter(){
remove_filter( 'product_type_options', 'ticket_type_option' );
}
//* Add custom Filter to replace the one from BOX OFFICE plugin
add_filter( 'product_type_options', 'ticket_type_option_custom', 99 );
function ticket_type_option_custom( $options = array() ) {
$options['ticket'] = array(
'id' => '_ticket',
'wrapper_class' => 'show_if_simple show_if_variable show_if_deposit show_if_subscription show_if_variable-subscription',
'label' => __( 'Ticket', 'woocommerce-box-office' ),
'description' => __( 'Each ticket purchased will have attendee details added to it.', 'woocommerce-box-office' ),
'default' => 'no',
);
return $options;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment