javascript - How to properly change the url slug, without affecting the navigation "back" in the browser?

one text

I have a Wordpress store and I need different links for each variant.

I was able to get a plugin to create a slug for each variant.

But for each time the customer selects a variant, the url changes and if he hits "back" in the browser, he continues on the same page. Only the URL changes.

enter image description here enter image description here

Would it be possible to correct this behavior with javascript?

I need to prevent the slug to have a history entry, is it possible?

See this link https://blazee.com.br/produto/calca-feminina-cintura-alta-folgada/?attribute_cor=Preto&attribute_tamanho=P

Source