Nicole Thompson
Nicole Thompson

Reputation: 1

Create Email Notification function for Gravity Forms Product Add-ons Plugin

I am using the Gravity Forms Product Add-ons plugin for WooCommerce. Woo confirms that the Admin Notification email isn't a feature when the form is used on a product:

"Gravity Forms Add-Ons does not send email notifications when they are assigned to a product." (see FAQs: http://docs.woothemes.com/document/woocommerce-gravity-forms-product-addons/)

While I understand that it seems redundant given the form fields are all included in the WooCommerce email confirmations, the form I'm adding to my products is quite comprehensive and I'd prefer to keep all that messy extra data separate to the WooCommerce order transaction by having the usual Gravity Forms Admin Notification send via email also (I plan to remove the add-on fields from the WooCommerce emails).

Can anyone give me guidance on how to get the usual Gravity Forms Admin Notification email to send even when the form is assigned to a product, please?

Many thanks.

Upvotes: 0

Views: 1807

Answers (1)

Dave from Gravity Wiz
Dave from Gravity Wiz

Reputation: 2859

The WC GF Product Add-ons plugin disables the notifications via Gravity Forms' "gform_disable_notifications_{form-id}" filter. You should be able to remove it like so:

if( isset( $woocommerce_gravityforms ) ) {
    add_filter( 'gform_disable_notification', function( $disable, $notification, $form ) {
        remove_filter( 'gform_disable_notification_' . $form['id'], array( $woocommerce_gravityforms, 'disable_notifications'), 10, 3 );
    }, 10, 3 );
}

This would enable notifications for all forms attached to products. If you want to enable notifications for a specific form, you could simply use this:

add_filter( 'gform_disable_notification_#', '__return_false' );

Replace "#" with the ID of your form.

Upvotes: 1

Related Questions