LemonStand Version 1 Has Been Discontinued
This documentation is for LemonStand Version 1. LemonStand is now offered as a cloud-based eCommerce platform.
You can try the new LemonStand and learn about upgrading here.
Subscriptions class
The Subscriptions is an interface API class containing useful subscriptions functions.
Class methods
- is_active($product, $customer = null, $reset_cache = false) - allows you to check whether a currently logged in customer owns a subscription, specified with the subscription product SKU, and whether this subscription is active (paid) at the moment. The function returns Boolean value (TRUE or FALSE). Please note that if there a trial period or a grace period is active at the moment, the function will return TRUE even in case if the order/invoice is not paid yet.
The method have 3 parameters. Only the first parameter is required:- $product - specifies the subscription product object (Shop_Product) or the product SKU string.
- $customer - specifies the customer to check the subscription for. This method accepts the (Shop_Customer) object, or the customer identifier (a number). If this parameter is omitted, a currently logged in customer will be used.
- $reset_cache - cache control. By default the method caches subscription information between calls, so if you call the method multiple times for a same customer, no extra SQL queries will be issued. If you for some reason want to clear the method cache, pass the TRUE value to this parameter.
<? if (Subscriptions::is_active('membership')): ?> <p>This content is visible only for customers which purchased a subscription product with the "membership" SKU.</p> <? endif ?>
Next: Subscriptions_Plan class
Previous: API extensions
Return to API extensions