Last active
December 6, 2023 11:55
-
-
Save Crocoblock/9c3401287b3f91c88d2e7383bfcf1e97 to your computer and use it in GitHub Desktop.
JetFormBuilder Woo Checkout action disable redirect to checkout
This file contains 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 Call Hook as a first action to the form in which redirect should be disabled | |
//name should be disable-checkout-redirect | |
add_action( 'jet-form-builder/custom-action/disable-checkout-redirect', function() { | |
//load cart before adding product to cart | |
add_action( 'jet-form-builder/action/redirect_to_woo_checkout/before-add', function() { | |
WC()->cart->get_cart(); | |
}, 0 ); | |
//do not remove product from cart | |
remove_action( | |
'jet-form-builder/action/redirect_to_woo_checkout/before-add', | |
array( \Jet_FB_Woo\Plugin::instance()->wc, 'on_before_add_to_cart' ), | |
10 | |
); | |
//do not redirect to checkout | |
remove_action( | |
'jet-form-builder/action/redirect_to_woo_checkout/after-add', | |
array( \Jet_FB_Woo\Plugin::instance()->wc, 'on_after_add_to_cart' ), | |
10 | |
); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment