• I’m trying to implement custom WC emails to trigger based on actions on the admin side. For example, I created an admin page where you upload shipping tracking information, and based on the contents, it will email the customers the tracking information, I am using a custom class that extends the WC_Email class and doing the following to trigger the e-mails:

    add_filter( 'woocommerce_email_classes', 'shipping_tracking_class' );
    
    function lifetrak_shipping_tracking_class( $classes ) {
    	$classes['WC_Email_Shipping_Tracking'] = include( get_template_directory() . '/dir/to/custom/email/class.php' );
    	return $classes;
    }
    
    add_action( 'woocommerce_email', 'trigger_shipping_tracking_email' );
    
    function lifetrak_trigger_shipping_tracking_email( $emails_obj ) {
    	add_action( 'send_shipping_tracking_info', array( $emails_obj->emails['WC_Email_Shipping_Tracking'], 'trigger' ), 10, 2 );
    }

    Then on my admin page, after I upload my file and process data I do:

    do_action( 'send_shipping_tracking_info', $param1, $param2 );

    But the email doesn’t get sent, why is that?

    Is it because this doesn’t work on the admin side?

    Edit:

    I tried putting the hook send_shipping_tracking_info inside the custom class constructor instead of the woocommerce_email hook and it is still not sending the emails.

    https://www.ads-software.com/plugins/woocommerce/

  • The topic ‘Send custom WC emails’ is closed to new replies.