Skip to content

Instantly share code, notes, and snippets.

@alexmustin
Last active January 15, 2018 20:43
Show Gist options
  • Save alexmustin/f8b06b19307aab5dd4b8b1232e55a190 to your computer and use it in GitHub Desktop.
Save alexmustin/f8b06b19307aab5dd4b8b1232e55a190 to your computer and use it in GitHub Desktop.
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