Last active
December 18, 2024 22:34
-
-
Save LaxusCroco/e64d1fc2c61666573c35fee6f9bc1de5 to your computer and use it in GitHub Desktop.
This code sets the payment name to the value of the Text form field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( | |
'jet-form-builder/gateways/before-create', | |
function ( $request ) { | |
if ( | |
// execute this action only when paying through Stripe | |
! is_a( | |
$request, | |
\Jet_FB_Stripe_Gateway\Compatibility\Jet_Form_Builder\Actions\Create_Checkout_Session::class | |
) || | |
// You must have JetFormBuilder >= 3.1 | |
! function_exists( 'jet_fb_context' ) | |
) { | |
return; | |
} | |
// where 'text_field_name' - form field name | |
$value = jet_fb_context()->get_value( 'text_field_name' ); | |
$request->set_payment_name( \Jet_Form_Builder\Classes\Tools::to_string( $value ) ); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you Laxus!