return $price; } /** * Retruns true if the membership is limited. * @param WC_Product $product * @return boolean true if product group membership has duration defined, false otherwise */ public static function has_duration($product) { $duration = get_post_meta($product->id, '_groups_duration', true); return $duration > 0; } /** * Returns the duration of membership in seconds. * @param WC_Product $product * @return duration in seconds or null if there is none defined */ public static function get_duration($product) { $result = null; $duration = get_post_meta($product->id, '_groups_duration', true); if (!empty($duration)) { $duration_uom = get_post_meta($product->id, '_groups_duration_uom', true); $suffix = $duration > 1 ? 's' : ''; $result = strtotime('+' . $duration . ' ' . $duration_uom . $suffix) - time(); } return $result; } } Groups_WS_Product::init();