Skip to content

Commit

Permalink
fix(woocommerce-emails): use the default email payload if there are n…
Browse files Browse the repository at this point in the history
…o donation products (#3545)
  • Loading branch information
adekbadek authored Nov 21, 2024
1 parent 9d0fa0c commit 60c21f3
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ public static function force_disable_order_attribution( $should_allow ) {
* @return bool
*/
public static function send_customizable_receipt_email( $enable, $order, $class ) {
// If there are no donation products in the order, do not override the default WC receipt email.
$has_donation_product = \Newspack\Donations::get_order_donation_product_id( $order_id ) !== false;
if ( ! $has_donation_product ) {
return $enable;
}

// If we don't have a valid order, or the customizable email isn't enabled, bail.
if ( ! is_a( $order, 'WC_Order' ) || ! Emails::can_send_email( Reader_Revenue_Emails::EMAIL_TYPES['RECEIPT'] ) ) {
return $enable;
Expand Down

0 comments on commit 60c21f3

Please sign in to comment.