我有一个插件可以帮助我预订活动。我已经为提醒电子邮件和反馈电子邮件集成了一个邮件调度程序。
确认预订后,电子邮件会安排提醒和反馈。我有两个选项可以全局定义它,也可以单独定义每个事件。此类正在为计划的电子邮件添加操作。
class WooEvent_Reminder_Email {
public function __construct()
{
add_filter( 'exc_mb_meta_boxes', array($this,'email_reminder_metadata') );
// Schedule the event when the order is completed.
add_action( 'woocommerce_order_status_completed', array( $this, 'remind_email' ), 10, 1 );
add_action( 'woocommerce_order_status_completed', array( $this, 'remind_email_fb' ), 11, 1 );
// Trigger the email.
add_action( 'wooevent_email_reminder', array( &$this, 'send_mail' ),10,4 );
add_action( 'wooevent_email_reminder_2', array( $this, 'send_mail' ),10,4 );
add_action( 'wooevent_email_reminder_3', array( $this, 'send_mail' ),10,4 );
add_action( 'wooevent_email_reminder_feedback', array( $this, 'send_mail_fb' ),10,3);
// send email to attendee
add_action( 'we_send_email_reminder', array( &$this, 'send_mail_attendee' ),10,1 );
}
现在,由于某些原因,该事件没有发生,我为“事件停用”产品创建了另一个类别。如果是这个类别,我想禁用该事件以及删除所有进一步的电子邮件操作(即不再向客户发送通知)。为此,我正在运行以下代码:
add_filter('woocommerce_is_purchasable', 'nms3_catalog_mode_on_for_product', 10, 2 );
function nms3_catalog_mode_on_for_product( $is_purchasable, $product ) {
global $WooEvent_Reminder_Email;
if( has_term( 'seminar-deaktiviert', 'product_cat', $product->get_id() ) ) {
// you can set multiple conditions here
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
// Trigger the email.
remove_action( 'woocommerce_order_status_completed', array( $WooEvent_Reminder_Email, 'remind_email' ), 10, 1 );
remove_action( 'woocommerce_order_status_completed', array( $WooEvent_Reminder_Email, 'remind_email_fb' ), 11, 1 );
remove_action( 'wooevent_email_reminder', array( $WooEvent_Reminder_Email, 'send_mail' ), 10, 4 );
remove_action( 'wooevent_email_reminder_2', array( $WooEvent_Reminder_Email, 'send_mail' ), 10, 4 );
remove_action( 'wooevent_email_reminder_3', array( $WooEvent_Reminder_Email, 'send_mail' ), 10, 4 );
remove_action( 'wooevent_email_reminder_feedback', array( $WooEvent_Reminder_Email, 'send_mail_fb' ), 10, 1 );
// send email to attendee
remove_action( 'we_send_email_reminder', array( &$WooEvent_Reminder_Email, 'send_mail_attendee' ),10,1 );
return false;
}
return $is_purchasable;
}
对于哪个动作/过滤器,我应该使用上述或任何修改。
我可以根据类别禁用该事件,但已安排的电子邮件仍在排队。
任何建议或帮助将不胜感激。谢谢