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


Top ↑

Return Return

(boolean) true if it can be applied, false otherwise


Top ↑

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 );
		}
	}


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.