Unset a Cookie on Successful Gravity Forms form Submission [closed]

I ran this code to try setting a cookie on the gform_after_submission hook and it worked as expected.

add_action( 'gform_after_submission', function() {
    setcookie( 'boom', 'boom', time() + 3600, "https://wordpress.stackexchange.com/" );
} );

The headers should not already be sent when the gform_after_submission action is triggered. If you’re getting a warning about this, there might be something else outputting something to the page earlier in the process.