Sample code
jQuery(document).on('ready', function() { var variant = $('select.product-single__variants :selected').val(); console.log( variant ); var loc = window.location; var origin = location.origin; var pathname = location.pathname; var finalUrl = origin + pathname + "?variant=" + variant; //updating URL history.pushState({}, null, finalUrl); });