WooCommerce notification

Home » Snippets » WooCommerce notification
1

Created with:

WooCommerce Disable Emails Generator

Visibility: 

public

Creator: JuanJota

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project
				/**
 * Disable specific WooCommerce emails.
 *
 * This function disables specific WooCommerce emails depending on the store events.
 * It is hooked to the 'woocommerce_email' action and removes certain actions from the given WC_Emails object.
 * This function follows the WordPress coding standards for PHPDoc.
 *
 * @param WC_Emails $email_class The instance of the WC_Emails class.
 * 
 * @return void
 */
function wpturbo_custom_disable_emails( WC_Emails $email_class ) : void {
	// Hooks for sending emails during store events
	// Low Stock Notification
	remove_action( 'woocommerce_low_stock_notification', array( $email_class, 'low_stock' ) );

	// No Stock Notification
	remove_action( 'woocommerce_no_stock_notification', array( $email_class, 'no_stock' ) );

}
add_action( 'woocommerce_email', 'wpturbo_custom_disable_emails' );

			

Register an account to save your snippets or go Pro to get more features.