Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(the-product): change tab url when select variation #922

Merged
merged 3 commits into from
Jul 6, 2023

Conversation

matheusgnreis
Copy link
Member

Checklist

  • I've read and understood contributing guidelines;
  • If changing UI, I've tested on most common viewports, desktop and mobile devices;

Google set an example: https://www.usereserva.com/camiseta-pica-pau-bordado-neon0079375/p?idsku=412225&
When changing variations, the URL should be updated in the tab. They mentioned having a robot that emulates a human, so when accessing a link from the merchant, they select each variation and compare if that variation has a unique URL.

const searchParams = new URLSearchParams(window.location.search)
searchParams.set('variation_id', variationId)
const newRelativePathQuery = `${window.location.pathname}?${searchParams.toString()}`
history.pushState(null, '', newRelativePathQuery);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esse null? 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Era pra variar com o URL eu acredito

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ecomplus/storefront-components/src/js/TheProduct.js Outdated Show resolved Hide resolved
@leomp12 leomp12 merged commit b6f8f23 into master Jul 6, 2023
6 checks passed
@leomp12 leomp12 deleted the change-url-variation branch July 6, 2023 22:47
@leomp12
Copy link
Member

leomp12 commented Jul 6, 2023

O único problema é que o "voltar" do navegador ficou uma bosta na página de produto 🙃

@leomp12
Copy link
Member

leomp12 commented Jul 6, 2023

Na verdade acho que isso foi uma má ideia kkk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants