John Davidson

php - woocommorce disable redirect to cart page after submit

0 comments
Message:


<div class="submit-group">
<button class="btn btn-green btn-large btn-full upper btn-book-ajax" type="submit" name="submit">
Book Now
<i class="fa fa-spinner fa-spin hide"></i>
</button>
<input style="display:none;" type="submit" class="btn btn-default btn-send-message" data-id="9278" name="st_send_message" value="Send message">
</div>


the button class="btn btn-green btn-large btn-full upper btn-book-ajax" has the same function have to " add to cart " button in woo commerce


I am looking to disable add to cart redirection after submitting



My Answer:
To disable the redirect to the cart page after submitting an order in WooCommerce, you can use the following code snippet in your theme's functions.php file or in a custom plugin:

php
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_disable_redirect_to_cart' );

function custom_disable_redirect_to_cart( $url ) {
return false;
}


This code snippet hooks into the `woocommerce_add_to_cart_redirect` filter and returns `false`, which prevents the redirect to the cart page after submitting an order.

Rate this post

3 of 5 based on 3958 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us