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

[Shopify] feat: support for displaying videos on shopify products #992

Merged
merged 3 commits into from
Jan 24, 2025

Conversation

yuriassuncx
Copy link
Contributor

@yuriassuncx yuriassuncx commented Jan 24, 2025

What is this Contribution About?

Summary

This Pull Request adds support for fetching video data registered in Shopify for a product, allowing information like description, video URL, and preview image to be mapped and structured.

On Shopify, it's possible to add videos to product media. However, Deco.cx did not support this data. With this Pull Request, we have implemented the functionality to capture and display videos associated with products.

image

Changes Made

  1. Added GraphQL fragment for videos

    • Introduced a new fragment to query video-specific data:
      ... on Video {
          alt
          sources {
              url
          }
      }
  2. Filtering and mapping videos

    • Implemented logic to filter videos from media.nodes and map them into the appropriate format:
      video: media.nodes.filter((media) => media.mediaContentType === "VIDEO")
        .map((video) => ({
          "@type": "VideoObject",
          contentUrl: "sources" in video ? video.sources?.[0]?.url ?? "" : "",
          description: video.alt ?? "",
          thumbnailUrl: video.previewImage?.url,
        })),

Impact

  • Enables access and display of videos registered for products.
  • Video data is structured in a JSON-LD format, aligning with SEO best practices.

Copy link
Contributor

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.64.22 update
  • 🎉 for Minor 0.65.0 update
  • 🚀 for Major 1.0.0 update

@yuriassuncx yuriassuncx changed the title [Shopify] feat: add video support to product [Shopify] feat: support for displaying videos on shopify products Jan 24, 2025
Co-authored-by: Luis Sousa <lv-ss@hotmail.com>
@yuriassuncx
Copy link
Contributor Author

@IncognitaDev The way sources are accessed with this change implies a check error. Maybe we can revert to the old way to avoid this error?

image

@IncognitaDev
Copy link
Contributor

sure, but we can use undefined as fallback instead

@yuriassuncx
Copy link
Contributor Author

sure, but we can use undefined as fallback instead

I fixed it again so that the deno check doesn't complain

Copy link
Contributor

@IncognitaDev IncognitaDev left a comment

Choose a reason for hiding this comment

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

LGTM

@IncognitaDev IncognitaDev merged commit db6acb3 into deco-cx:main Jan 24, 2025
1 check passed
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