Refresh page after product added to cart

Automatically refresh the page after a product is added to the cart.

add_action('wp_footer', function() {
    ?>
        <script>
            jQuery(document.body).on("added_to_cart", function() {
                window.location.reload();
            });
        </script>
    <?php
});