Skip to content

Commit

Permalink
feat: better way to do it
Browse files Browse the repository at this point in the history
  • Loading branch information
adekbadek committed Nov 14, 2024
1 parent e9664ce commit b3e62f0
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,7 @@ public static function force_disable_order_attribution( $should_allow ) {
*/
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 = false;
$donation_product_ids = array_values( \Newspack\Donations::get_donation_product_child_products_ids() );
foreach ( $order->get_items() as $item_id => $item ) {
if ( in_array( $item->get_product()->get_id(), $donation_product_ids ) ) {
$has_donation_product = true;
break;
}
}
$has_donation_product = \Newspack\Donations::get_order_donation_product_id( $order_id ) !== false;
if ( ! $has_donation_product ) {
return $enable;
}
Expand Down

0 comments on commit b3e62f0

Please sign in to comment.