Garrettj944 Garrettj944 - 1 year ago 156
HTML Question

Woocommerce - Change Add to cart URL

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.

Here is the button's HTML:

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

Answer Source

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 );