Skip to content

Commit

Permalink
fix(reader-revenue): disable WC email if module will send email (#1709)
Browse files Browse the repository at this point in the history
Closes #1699
  • Loading branch information
adekbadek authored Jun 22, 2022
1 parent 586e693 commit 48e1613
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions includes/reader-revenue/class-stripe-connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static function init() {
add_action( 'rest_api_init', [ __CLASS__, 'register_api_endpoints' ] );
add_action( 'init', [ __CLASS__, 'handle_merchant_id_file_request' ] );
add_action( 'init', [ __CLASS__, 'register_apple_pay_domain' ] );
add_filter( 'woocommerce_email_enabled_customer_completed_order', [ __CLASS__, 'is_wc_complete_order_email_enabled' ] );
}

/**
Expand Down Expand Up @@ -879,6 +880,18 @@ public static function register_apple_pay_domain() {
return;
}
}

/**
* Disable WC's order complete email, if the email will be sent by this integration.
*
* @param bool $is_enabled True if enabled.
*/
public static function is_wc_complete_order_email_enabled( $is_enabled ) {
if ( Donations::is_platform_stripe() && Reader_Revenue_Emails::supports_emails() ) {
$is_enabled = false;
}
return $is_enabled;
}
}

Stripe_Connection::init();

0 comments on commit 48e1613

Please sign in to comment.