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.


Top ↑

Parameters Parameters

$email

(string) (Required) An email address.

$plan_id

(int) (Required) Access plan WP_Post ID.


Top ↑

Return Return

(null|int) Returns the post id if found, otherwise returns null.


Top ↑

Source Source

File: includes/functions/llms.functions.order.php

 * @since 7.0.0
 *
 * @param string $email   An email address.
 * @param int    $plan_id Access plan WP_Post ID.
 * @return null|int Returns the post id if found, otherwise returns `null`.
 */
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,
				),
			),


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.