LLMS_Voucher::get_voucher_by_code( string $code )
Get a single voucher code by string
Parameters Parameters
- $code
-
(string) (Required) Voucher code string.
Return Return
(obj)
Source Source
File: includes/class.llms.voucher.php
public function get_voucher_by_code( $code ) { global $wpdb; $table = $this->get_codes_table_name(); $redeemed_table = $this->get_redemptions_table_name(); $query = "SELECT c.*, count(r.id) as used FROM $table as c LEFT JOIN $redeemed_table as r ON c.`id` = r.`code_id` WHERE `code` = '$code' AND `is_deleted` = 0 GROUP BY c.id LIMIT 1"; return $wpdb->get_row( $query ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |