llms_locate_order_for_email_and_plan( string $email, int $plan_id )
Locates an order by email address and access plan ID.
Description Description
Used during AJAX checkout order creation when users are not created until the gateway confirms success.
Ensures that only a single pending order for a given plan and email address will exist at any given time.
Parameters Parameters
-
(string) (Required) An email address.
- $plan_id
-
(int) (Required) Access plan WP_Post ID.
Return Return
(null|int) Returns the post id if found, otherwise returns null
.
Source Source
File: includes/functions/llms.functions.order.php
function llms_locate_order_for_email_and_plan( $email, $plan_id ) { $query = new WP_Query( array( 'post_type' => 'llms_order', 'post_status' => 'llms-pending', 'fields' => 'ids', 'posts_per_page' => 1, 'no_found_rows' => true, 'meta_query' => array( 'relation' => 'AND', array( 'key' => '_llms_billing_email', 'value' => $email, ), array( 'key' => '_llms_plan_id', 'value' => $plan_id, ), ), ) ); return $query->posts[0] ?? null; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
7.0.0 | Introduced. |