Posted on

Redirect to the Cart page when winner clicks Pay Now

Redirect to the Cart page instead of going directly to Checkout when winning bidder clicks Pay Now, this code snippet requires Auctions for WooCommerce v2.5 or higher:

add_filter( 'auctions_for_woocommerce_pay_now_button' , 'custom_auctions_for_woocommerce_pay_now_button', 10);
function custom_auctions_for_woocommerce_pay_now_button( $data ){
    global $product;
    if ( ! $product ) {
        return $data;
    }
    return esc_url( add_query_arg( 'pay-auction', $product->get_auction_id(), wc_get_cart_url() ) );
}
add_filter( 'auctions_for_woocommerce_pay_auction_redirect' , 'custom_auctions_for_woocommerce_pay_auction_redirect', 10);
function custom_auctions_for_woocommerce_pay_auction_redirect( $data ){
    return esc_url( remove_query_arg( array( 'pay-auction', 'quantity', 'product_id' ), wc_get_cart_url() ) );
}