Send Low and Out-of-Stock Alerts to Your Buyer
Sends WooCommerce low stock and out-of-stock notifications to a purchasing or inventory address instead of the store admin.
Opens WPIDE on
Code
$wpide_stock_alert_to = ''; // For example '[email protected]'.
add_filter( 'woocommerce_email_recipient_low_stock', function ( $recipient ) use ( $wpide_stock_alert_to ) {
return is_email( $wpide_stock_alert_to ) ? $wpide_stock_alert_to : $recipient;
} );
add_filter( 'woocommerce_email_recipient_no_stock', function ( $recipient ) use ( $wpide_stock_alert_to ) {
return is_email( $wpide_stock_alert_to ) ? $wpide_stock_alert_to : $recipient;
} );
Notes
Set $address. Leave it empty to keep the default recipient.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.