Skip to content

Commit

Permalink
gspc-trigger-wp-fusion-feed.php: Added new snippet to improve GSPC …
Browse files Browse the repository at this point in the history
…compatibility with WP Fusion.
  • Loading branch information
claygriffiths authored Nov 2, 2023
1 parent 3fefeb2 commit b9fca3b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gs-product-configurator/gspc-trigger-wp-fusion-feed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Gravity Shop // GS Product Configurator // Trigger WP Fusion feed when payment is delayed
*
* WP Fusion does not register its Gravity Forms add-on using `GFAddOn::register`, nor does it
* run `add_delayed_payment_support` which means the feed won't run when the payment is delayed.
*
* This snippet works around that.
*/
add_action('plugins_loaded', function() {
if ( function_exists( 'wp_fusion' ) ) {
add_action( 'gform_trigger_payment_delayed_feeds', function ( $transaction_id, $payment_feed, $entry, $form ) {
if ( ! property_exists( wp_fusion(), 'integrations' ) || ! property_exists( wp_fusion()->integrations, 'gravity-forms' ) ) {
return;
}

$addon = wp_fusion()->integrations->{'gravity-forms'};

add_filter( 'gspc_delay_feed_processing', '__return_false', 9998 );
$addon->maybe_process_feed( $entry, $form );
remove_filter( 'gspc_delay_feed_processing', '__return_false', 9998 );
}, 10, 4 );
}
});

0 comments on commit b9fca3b

Please sign in to comment.