Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Last active December 6, 2023 11:55
Show Gist options
  • Save Crocoblock/9c3401287b3f91c88d2e7383bfcf1e97 to your computer and use it in GitHub Desktop.
Save Crocoblock/9c3401287b3f91c88d2e7383bfcf1e97 to your computer and use it in GitHub Desktop.
JetFormBuilder Woo Checkout action disable redirect to checkout
<?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