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

Remove Skeleton PDP first variant redirect #2643

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

scottdixon
Copy link
Contributor

WHY are these changes introduced?

Resolves https://github.com/Shopify/hydrogen-internal/issues/120

At the moment the Skeleton PDP 302 redirects to the first available variant. This was done to make the code simpler (the loader exclusively relies on search params). But this negatively affects performance

WHAT is this pull request doing?

This update removes the redirect by leveraging the Storefront API's new product.selectedOrFirstAvailableVariant field.

It also updates the VariantSelector to accept a new (optional) selectedVariant prop for default selected values. Since no URL params are set on the initial page load, the variant selector uses these values to highlight selected values.

A canonical link has also been added to the product page to avoid SEO issues with multiple URLs pointing to the same place.

HOW to test your changes?

Run the Skeleton PDP locally against a variety of products. Test products with varying options and availability.

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

This comment has been minimized.

Copy link
Contributor

shopify bot commented Nov 13, 2024

Oxygen deployed a preview of your sd-remove-pdp-redirect branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
metaobjects ✅ Successful (Logs) Preview deployment Inspect deployment November 14, 202412:26 AM
classic-remix ✅ Successful (Logs) Preview deployment Inspect deployment November 14, 202412:26 AM
custom-cart-method ✅ Successful (Logs) Preview deployment Inspect deployment November 14, 202412:26 AM
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment November 14, 202412:26 AM
third-party-queries-caching ✅ Successful (Logs) Preview deployment Inspect deployment November 14, 202412:26 AM

Learn more about Hydrogen's GitHub integration.

Copy link
Contributor

@wizardlyhel wizardlyhel left a comment

Choose a reason for hiding this comment

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

Minor changes

templates/skeleton/app/components/ProductForm.tsx Outdated Show resolved Hide resolved
templates/skeleton/app/routes/products.$handle.tsx Outdated Show resolved Hide resolved
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