Disable add to cart redirection
WooCommerce by default provides the setting for you. Just check if this solution fits your requirement.
Try to use wp_get_referer as shown
add_filter( 'woocommerce_add_to_cart_redirect', 'wp_get_referer' );
Here is the answer. If you want custom redirection, there is a filter for that:
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_redirect_function' ); function custom_redirect_function() { return get_permalink( wc_get_page_id( 'shop' ) );}