Skip to content

Instantly share code, notes, and snippets.

@rafsuntaskin
Last active October 9, 2019 06:27
Show Gist options
  • Save rafsuntaskin/2f0f9360754c00a253d1065ea54b1735 to your computer and use it in GitHub Desktop.
Save rafsuntaskin/2f0f9360754c00a253d1065ea54b1735 to your computer and use it in GitHub Desktop.
Fix WooCommerce Email conflict with ET+
<?php
add_action( 'wp_loaded', 'rt_remove_ticket_email', 80 );
/**
* Remove the main filter of ET email and add it again with a check to prevent fatal errors
*/
function rt_remove_ticket_email() {
if ( ! function_exists( 'tribe' ) ) {
return;
}
remove_filter( 'woocommerce_email_classes', array( tribe( 'tickets-plus.commerce.woo' ), 'add_email_class_to_woocommerce' ) );
add_filter( 'woocommerce_email_classes', function ( $classes ) {
if ( ! class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Email' ) ) {
return $classes;
}
$classes['Tribe__Tickets__Woo__Email'] = new Tribe__Tickets_Plus__Commerce__WooCommerce__Email();
return $classes;
} );
}
@rafsuntaskin
Copy link
Author

This is deprecated since Event Tickets v4.10.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment