Right now I am using this function to redirect to the checkout page after adding a product to cart on my page with product grid:
function bbloomer_redirect_checkout_add_cart( $url ) {
$url = get_permalink( get_option( 'woocommerce_checkout_page_id' ) );
return $url;
}
add_filter( 'woocommerce_add_to_cart_redirect', 'bbloomer_redirect_checkout_add_cart' );
Instead of this I want the current page to reload with a parameter. For example
?addedtocart=productname
. Is there any function or hook for it?
EDIT:
When editing the function to this:
function bbloomer_redirect_checkout_add_cart( $url ) {
$url = var_dump($url);
return $url;
}
add_filter( 'woocommerce_add_to_cart_redirect', 'bbloomer_redirect_checkout_add_cart' );
The output is like this:
string(0) "" string(41) "http://URL/winkelmand/"