LLMS_Order_Generator::validate_order()

Validates the order.


Description Description

Ensures the submitted order key is valid and that the order can be confirmed.


Top ↑

Return Return

(boolean|WP_Error) Returns true on success or an error object.


Top ↑

Source Source

File: includes/class-llms-order-generator.php

	protected function validate_order() {

		$order_id = $this->get_order_id();

		if ( 'new' === $order_id || 'llms_order' !== get_post_type( $order_id ) ) {
			return $this->error(
				self::E_ORDER_NOT_FOUND,
				__( 'Could not locate an order to confirm.', 'lifterlms' )
			);
		}

		$order = llms_get_post( $order_id );
		if ( ! $order->can_be_confirmed() ) {
			return $this->error(
				self::E_ORDER_NOT_CONFIRMABLE,
				__( 'Could not locate an order to confirm.', 'lifterlms' )
			);
		}

		$this->order = $order;
		return true;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.