ntf( // translators: %s is an email address. __( 'Billing email updated to %s.', 'woocommerce' ), esc_html( $email ) ); } /** * Check if a given order has any partial refunds. * * Based on heuristics in the `wc_create_refund()` function. * * @param WC_Order $order An order object. * * @return bool */ private function order_is_partially_refunded( WC_Order $order ): bool { $remaining_amount = $order->get_remaining_refund_amount(); $remaining_items = $order->get_remaining_refund_items(); $refunds = $order->get_refunds(); $last_refund = reset( $refunds ); // phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment /** This filter is documented in includes/wc-order-functions.php */ $partially_refunded = apply_filters( 'woocommerce_order_is_partially_refunded', count( $refunds ) > 0 && ( $remaining_amount > 0 || ( $order->has_free_item() && $remaining_items > 0 ) ), $order->get_id(), $last_refund ? $last_refund->get_id() : 0 ); return (bool) $partially_refunded; } }