Automattic\WooCommerce\StoreApi\Utilities

OrderController::validate_existing_order_before_paymentpublicWC 1.0

Final validation for existing orders, ran before payment is taken.

By this point we have an order populated with customer data and items.

Since the cart is not involved, we don't validate shipping methods and assume the order already contains the correct shipping items.

Method of the class: OrderController{}

No Hooks.

Returns

null. Nothing (null).

Usage

$OrderController = new OrderController();
$OrderController->validate_existing_order_before_payment( $order );
$order(WC_Order) (required)
Order object.

OrderController::validate_existing_order_before_payment() code WC 10.8.1

public function validate_existing_order_before_payment( \WC_Order $order ) {
	$needs_shipping = $order->needs_shipping();

	$this->validate_coupons( $order, true );
	$this->validate_email( $order );
	$this->validate_addresses( $order, $needs_shipping );

	// Perform custom validations.
	$this->perform_custom_order_validation( $order );
}