llms_find_coupon( string $code = '', int $dupcheck_id )

Get the most recently created coupon ID for a given code


Description Description


Parameters Parameters

$code

(string) (Optional) the coupon's code (title)

Default value: ''

$dupcheck_id

(int) (Required) an optional coupon id that can be passed which will be excluded during the query this is used to dupcheck the coupon code during coupon creation


Top ↑

Return Return

(int)


Top ↑

Source Source

File: includes/llms.functions.core.php

function llms_find_coupon( $code = '', $dupcheck_id = 0 ) {

	global $wpdb;
	return $wpdb->get_var( $wpdb->prepare(
		"SELECT ID
		 FROM {$wpdb->posts}
		 WHERE post_title = %s
		 AND post_type = 'llms_coupon'
		 AND post_status = 'publish'
		 AND ID != %d
		 ORDER BY ID desc;
		",
		array( $code, $dupcheck_id )
	) );

}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: