Deprecated: 関数 WP_Dependencies->add_data() がバージョン 6.9.0 から非推奨になった引数付きで呼び出されました。IE の条件付きコメントは、対応しているすべてのブラウザで無視されます。 in /home/artws/woo-japan.info/public_html/wp-includes/functions.php on line 6131

Deprecated: 関数 WP_Dependencies->add_data() がバージョン 6.9.0 から非推奨になった引数付きで呼び出されました。IE の条件付きコメントは、対応しているすべてのブラウザで無視されます。 in /home/artws/woo-japan.info/public_html/wp-includes/functions.php on line 6131
コンテンツへスキップ →

unhook–remove-woocommerce-emails

Unhook and remove WooCommerce emails

このコードにより、WooCommerceのデフォルトEメールのフックを外し、削除することができます。

if ( ! function_exists( 'YOUR_PREFIX_unhook_woocommerce_emails' ) ) {
    /**
     * Callback for woocommerce_email action hook
     *
     * @param WC_Email $email_class An Email class instance.
     * @return void
     */
    function YOUR_PREFIX_unhook_woocommerce_emails( $email_class ) {
        /**
         * Hooks for sending emails during store events.
         */
        remove_action( 'woocommerce_low_stock_notification', array( $email_class, 'low_stock' ) );
        remove_action( 'woocommerce_no_stock_notification', array( $email_class, 'no_stock' ) );
        remove_action( 'woocommerce_product_on_backorder_notification', array( $email_class, 'backorder' ) );

        // New order emails.
        remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
        remove_action( 'woocommerce_order_status_pending_to_completed_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
        remove_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
        remove_action( 'woocommerce_order_status_failed_to_processing_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
        remove_action( 'woocommerce_order_status_failed_to_completed_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
        remove_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );

        // Processing order emails.
        remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
        remove_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $email_class->emails['WC_Email_Customer_On_Hold_Order'], 'trigger' ) );

        // Completed order emails.
        remove_action( 'woocommerce_order_status_completed_notification', array( $email_class->emails['WC_Email_Customer_Completed_Order'], 'trigger' ) );

        // Note emails.
        remove_action( 'woocommerce_new_customer_note_notification', array( $email_class->emails['WC_Email_Customer_Note'], 'trigger' ) );
    }
}
add_action( 'woocommerce_email', 'YOUR_PREFIX_unhook_woocommerce_emails' );