Automattic\WooCommerce\Internal\OrderWithdrawal

OrderWithdrawalFormProcessor::send_order_withdrawal_emails │ private │ WC 1.0

Send customer and merchant order withdrawal emails.

Method of the class: OrderWithdrawalFormProcessor{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->send_order_withdrawal_emails( $data, ?WC_Order $matched_order ): bool;
$data(array<string,string>) (required)
Form data.
?WC_Order $matched_order(required)
.

OrderWithdrawalFormProcessor::send_order_withdrawal_emails() code WC 11.1.2

private function send_order_withdrawal_emails( array $data, ?WC_Order $matched_order ): bool {
	try {
		$submitted_at  = time();
		$customer_sent = $this->send_customer_order_withdrawal_email( $data, $submitted_at );
		$merchant_sent = $this->send_merchant_order_withdrawal_email( $data, $matched_order, $submitted_at );
	} catch ( Throwable $e ) {
		$this->log_email_error( $e );

		return false;
	}

	if ( ! $customer_sent || ! $merchant_sent ) {
		$this->log_email_error(
			sprintf(
				'Order withdrawal notification email failed. Customer email sent: %s. Merchant email sent: %s.',
				$customer_sent ? 'yes' : 'no',
				$merchant_sent ? 'yes' : 'no'
			)
		);

		return false;
	}

	return true;
}