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
Return Return
(int)
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 ) ) ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: