-
Notifications
You must be signed in to change notification settings - Fork 67
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
Feature/gcom 1120 | Improve defaultConfigurableOptionsSelection functionality #1991
Conversation
🦋 Changeset detectedLatest commit: ac6678d The changes in this PR will be included in the next version bump. This PR includes changesets to release 72 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried moving away from the variants field as this could negatively impact performance. However, it seems that we are 'stuck' with it in this case.
packages/magento-product-configurable/utils/defaultConfigurableOptionsSelection.ts
Outdated
Show resolved
Hide resolved
packages/magento-product-configurable/graphql/ConfigurableOptions.graphql
Outdated
Show resolved
Hide resolved
packages/magento-product-configurable/graphql/ConfiguredVariant.graphql
Outdated
Show resolved
Hide resolved
packages/magento-product-configurable/utils/defaultConfigurableOptionsSelection.ts
Outdated
Show resolved
Hide resolved
packages/magento-product-configurable/utils/defaultConfigurableOptionsSelection.ts
Outdated
Show resolved
Hide resolved
packages/magento-product-configurable/utils/defaultConfigurableOptionsSelection.ts
Outdated
Show resolved
Hide resolved
We currently never redirect a user and in the upcoming ConfigurableProductUrl PR only the URL is changed in the browser, but the page isn't actually reloaded. It is kinda odd if a user will receive multiple configurables for the simple URL. |
…eOptionsSelection.ts Co-authored-by: Paul Hachmang <paul@reachdigital.nl>
…eOptionsSelection.ts Co-authored-by: Paul Hachmang <paul@reachdigital.nl>
…t.graphql Co-authored-by: Paul Hachmang <paul@reachdigital.nl>
…ons.graphql Co-authored-by: Paul Hachmang <paul@reachdigital.nl>
|
|
|
packages/magento-product-configurable/utils/defaultConfigurableOptionsSelection.ts
Outdated
Show resolved
Hide resolved
packages/magento-product-configurable/utils/defaultConfigurableOptionsSelection.ts
Outdated
Show resolved
Hide resolved
|
In this PR:
1. Improve defaultConfigurableOptionsSelection functionality
Situation: You land on a simple product page.
In the current main branch, we check all the configurableOptions of the linked configurable item. If a simple product does not have this option as a property on it's product branch, the option can not be configured on the simple product page. To fix this, you had to query that option in your productPage query to make it a property on the simple product. This however meant that you had to add a property to your query every time a site owner made a new configurable option. This is not dynamic nor scalable.
To fix this:
We check the variants of a configurable option and match the variant SKU's with the SKU of the current simple product. When we know which variant should be preselected, we get the uid(s) from the variant's attribute(s) and inject them into the selectedOptions array.
2. Match the CORRECT related upsells with the CORRECT product
In the current main branch, the first item of the relatedUpsells array is being merged into the product object. But in case of a simple product, magento not only gives the simple product back, but also optional configurable products that are linked to it. Merging relatedUpsells[0] with the simple product will result in merging the wrong upsells with the simple product.
Test url
Please replace localhost for Vercel URL.
Simple product: localhost:3000/p/waverly-size-4-6y-gc-564-sock-6y
Concurrent configurable product: localhost:3000/p/gc-fruity-sock
Issues: