Showing dynamic or different menus on wordpress not working in my theme

On my WordPress page, there’s a primary menu that shows up at the header of all pages, but I want to show a different set of menus for pages in the route /tech-products.

Based on my research on this site, adding the following to my function.php and then setting up the menu in Appearance → Menus → Manage Locations is expected to work, but it doesn’t work.

function register_custom_menus() {
    register_nav_menus(array(
        'primary' => 'Primary Menu',
        'tech_products_menu' => 'Tech Products Menu',
    ));
}
add_action('init', 'register_custom_menus');