Php – WooCommerce – Change Add to cart URL

htmlPHPwoocommerceWordpress

I am using WooCommerce Product Bundles, and at the end of the product there is an Add to Cart button. Clicking it refreshed the page, and adds the addons to the cart. I want to change the URL to a different page, instead of just refreshing it.

Here is the button's HTML code:

<button type="submit" class="single_add_to_cart_button bundle_add_to_cart_button button alt">Add to cart</button>

Best Answer

If I got it correctly, you want to redirect to different page after the add to cart action done right.?

If that is the case put this on your functions.php

function redirect_after_add_to_cart( $url ) {
    return esc_url( get_permalink( get_page_by_title( 'Your Page Title' ) ) );
}
add_filter( 'woocommerce_add_to_cart_redirect', 'redirect_after_add_to_cart', 99 );
Related Topic