Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,14 @@ 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->get_id() ) !== false;
if ( ! $has_donation_product ) {
// If we don't have a valid order, or the customizable email isn't enabled, bail.
if ( empty( $order ) || ! is_a( $order, 'WC_Order' ) || ! Emails::can_send_email( Reader_Revenue_Emails::EMAIL_TYPES['RECEIPT'] ) ) {
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'] ) ) {
// 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->get_id() ) !== false;
if ( ! $has_donation_product ) {
return $enable;
}

Expand Down