Automattic\WooCommerce\StoreApi\Utilities

OrderController::validate_order_before_payment()publicWC 1.0

Final validation ran before payment is taken.

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

Method of the class: OrderController{}

No Hooks.

Return

null. Nothing (null).

Usage

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

OrderController::validate_order_before_payment() code WC 8.9.0

public function validate_order_before_payment( \WC_Order $order ) {
	$needs_shipping          = wc()->cart->needs_shipping();
	$chosen_shipping_methods = wc()->session->get( 'chosen_shipping_methods', [] );

	$this->validate_coupons( $order );
	$this->validate_email( $order );
	$this->validate_selected_shipping_methods( $needs_shipping, $chosen_shipping_methods );
	$this->validate_addresses( $order );
}