Trying to insert a div ID link into Woocommerce shortcode Pagination

A certain chatty AI found me a solution.

add_action( 'wp_footer', 'custom_pagination_script' );
  function custom_pagination_script() {
  ?>
    <script type="text/javascript">
    jQuery( document ).ready( function( $ ) {
        $( '.page-numbers a' ).click( function( event ) {
            event.preventDefault();
            var link = $( this ).attr( 'href' );
            window.location = link + '#d3c-psf-products';
        } );
    } );
    </script>
    <?php
}

add_action( 'wp_footer', 'custom_sorting_script' );
function custom_sorting_script() {
    ?>
    <script type="text/javascript">
    jQuery( document ).ready( function( $ ) {
        $( '.woocommerce-ordering' ).submit( function( event ) {
            event.preventDefault();
            var link = $( this ).attr( 'action' ) + '?' + $( this ).serialize() + '#d3c-psf-products';
            window.location = link;
        } );
    } );
    </script>
    <?php
}

This solution does what I want perfectly.