GFCoupons is the class which houses the main functionality of the Gravity Forms Coupons Add-on, it extends the GFFeedAddOn class which is part of the add-on framework. Below are a few functions which you may find useful when working on your own custom code.
The gf_coupons() function is used to return an instance of the GFCoupons class.
Retrieves any submitted coupon codes from the entry object.
$coupon_codes = gf_coupons()->get_submitted_coupon_codes( $form, $entry );
Retrieves the properties for the specified coupon codes.
$coupons = gf_coupons()->get_coupons_by_codes( $codes, $form );
The insert_feed() method can be used to add new coupons.
$feed_id = gf_coupons()->insert_feed( $form_id, $is_active, $meta );
- $form_id integer
The ID of the form this coupon can be used with or 0 if it can be used with all forms.
Is this coupon active or inactive.
$meta Coupons Feed Meta
An associative array containing the properties which determine the type of coupon and discount available.
The ID of the new feed.