mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-30 11:42:22 +08:00
https://www.businessbloomer.com/woocommerce-disable-customer-order-email-for-free-orders/
10 lines
432 B
Text
10 lines
432 B
Text
add_filter( 'woocommerce_email_recipient_customer_completed_order', 'wc_disable_customer_order_email_if_free', 10, 2 );
|
|
|
|
function wc_disable_customer_order_email_if_free( $recipient, $order ) {
|
|
$page = $_GET['page'] = isset( $_GET['page'] ) ? $_GET['page'] : '';
|
|
if ( 'wc-settings' === $page ) {
|
|
return $recipient;
|
|
}
|
|
if ( (float) $order->get_total() === '0.00' ) $recipient = '';
|
|
return $recipient;
|
|
}
|