LLMS_Order_Generator::get_order_id()
Retrieves the order id to use for the order.
Description Description
Attempts to locate an existing pending order by order key if it was submitted, otherwise returns new
which denotes a new order should be created.
Return Return
(integer|string)
Source Source
File: includes/class-llms-order-generator.php
protected function get_order_id() { $order_id = null; $key = $this->data['llms_order_key'] ?? null; $email = $this->data['email_address'] ?? null; $plan_id = $this->data['llms_plan_id'] ?? null; // Try to lookup using the order key if it was supplied. if ( $key ) { $order_id = $this->sanitize_retrieved_order_id( llms_get_order_by_key( $key, 'id' ) ); } // Try to lookup by user ID. if ( ! $order_id ) { $user_id = $this->find_user_id( $email ); $order_id = $user_id ? $this->sanitize_retrieved_order_id( llms_locate_order_for_user_and_plan( $user_id, $plan_id ) ) : null; } // Lookup by email address. if ( ! $order_id && $email ) { $order_id = $this->sanitize_retrieved_order_id( llms_locate_order_for_email_and_plan( $email, $plan_id ) ); } return $order_id ? $order_id : 'new'; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
7.0.0 | Introduced. |