LLMS_Coupon::applies_to_product( int $product_id )
Determine if a coupon can be applied to a specific product
Parameters Parameters
- $product_id
-
(int) (Required) WP Post ID of a LLMS Course or Membership
Return Return
(boolean) true if it can be applied, false otherwise
Source Source
File: includes/models/model.llms.coupon.php
public function applies_to_product( $product_id ) {
$products = $this->get_products();
// No product restrictions.
if ( empty( $products ) ) {
return true;
} else {
return in_array( $product_id, $products );
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |