Skip to content

feat: pdp product SKU meta tag - #3383

Closed
thiagopereira-vtex wants to merge 2 commits into
devfrom
feat/pdp-product-sku-meta-tag
Closed

thiagopereira-vtex wants to merge 2 commits into
devfrom
feat/pdp-product-sku-meta-tag

Conversation

@thiagopereira-vtex

@thiagopereira-vtex thiagopereira-vtex commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

What's the purpose of this pull request?

This PR enriches the Product Details Page (PDP) metadata by exposing the product's SKU, name, category, and URL as tags. The Activity Flow tracking script reads page metadata to capture the product view event, but without these fields it couldn't reliably associate the event with the exact product the shopper was viewing.

Beyond tracking, this also improves SEO: structured, machine-readable product metadata in the page gives crawlers and social/commerce platforms (Open Graph product consumers, shopping feeds, etc.) clearer signals about what the page represents.

How it works?

On the PDP (packages/core/src/pages/[slug]/p.tsx), new entries are added to the additionalMetaTags passed to NextSeo, alongside the existing product:price:amount and product:price:currency tags:

{
  property: 'product:sku',
  content: product.sku,
},
{
  property: 'product:name',
  content: product.name,
},
{
  property: 'product:category',
  content: itemListElements[0]?.name ?? undefined,
},
{
  property: 'product:url',
  content: meta.canonical,
},

Data sources:

  • product:sku → product.sku
  • product:name → product.name
  • product:category → itemListElements[0]?.name (the first breadcrumb level, the same source used by ProductJsonLd's category), guarded with optional chaining since the breadcrumb list can be empty.
  • product:url → meta.canonical (the canonical product URL)

These render as <meta property="product:*" content="..." /> tags in the document <head>, making the current product's data available to the Activity Flow script and any other consumer reading the page metadata.

How to test it?

  • Run the core app and open a Product Details Page.
  • Inspect the page <head> and confirm the following tags are present with correct values for the selected product variation:
    • <meta property="product:sku" content="...">
    • <meta property="product:name" content="...">
    • <meta property="product:category" content="...">
    • <meta property="product:url" content="...">
  • Navigate between products/variations and confirm the metadata updates accordingly.
  • Open a product with no breadcrumb data and confirm the page still renders without errors (the product:category tag is simply omitted).
  • With the Activity Flow script enabled, trigger a product view and verify the product view event is captured with the correct SKU, name, category, and URL data.

Starters Deploy Preview

References

Checklist

You may erase this after checking them all 😉

PR Title and Commit Messages

  • PR title and commit messages follow the Conventional Commits specification
    • Available prefixes: feat, fix, chore, docs, style, refactor, ci and test

PR Description

  • Added a label according to the PR goal - breaking change, bug, contributing, performance, documentation..

Dependencies

  • Committed the pnpm-lock.yaml file when there were changes to the packages

Documentation

  • PR description
  • For documentation changes, ping @Mariana-Caetano to review and update (Or submit a doc request)

Summary by CodeRabbit

  • Chores
    • Improved product page SEO and social sharing metadata to include product identifiers (SKU, name), category and canonical URL, plus brand and condition — enhancing how products appear in search results and when shared across social platforms.

@thiagopereira-vtex
thiagopereira-vtex requested a review from a team as a code owner June 8, 2026 20:20
@thiagopereira-vtex
thiagopereira-vtex requested review from eduardoformiga and removed request for a team June 8, 2026 20:20
@thiagopereira-vtex thiagopereira-vtex added the contributing Pull request submitted by the community label Jun 8, 2026
@coderabbitai

coderabbitai Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Product page NextSeo additionalMetaTags now include product:id, product:sku, product:name, product:category (from first breadcrumb), product:url (from meta.canonical), product:brand, and product:condition ('new'); existing price meta tags unchanged.

Changes

Product Page SEO Metadata

Layer / File(s) Summary
Product page SEO metadata enhancement
packages/core/src/pages/[slug]/p.tsx
Extended NextSeo additionalMetaTags with product:id, product:sku, product:name, product:category (from first breadcrumb item), product:url (from meta.canonical), product:brand, and product:condition ('new'). Existing product:price:amount and product:price:currency remain unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

enhancement

Suggested reviewers

  • eduardoformiga
  • lemagnetic

Poem

📦 Product tags now gleam and hum,
SKU and name and brand in sum,
Breadcrumbs whisper category true,
Canonical URL points the view,
Metadata set — SEO's debut.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: pdp product SKU meta tag' accurately summarizes the main change: adding product metadata tags to the PDP, with SKU being the primary focus alongside related product properties.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pdp-product-sku-meta-tag

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codesandbox-ci

codesandbox-ci Bot commented Jun 8, 2026 •

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@thiagopereira-vtex thiagopereira-vtex changed the title Feat/pdp product SKU meta tag feat: pdp product SKU meta tag Jun 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR enriches PDP SEO/head metadata by adding product-identifying <meta property="product:*" ...> tags so external consumers (e.g., Activity Flow tracking) can reliably read SKU/name/category/URL for the currently viewed product.

Changes:

  • Adds product:sku and product:name meta tags sourced from product.
  • Adds product:category meta tag sourced from the first breadcrumb (when available).
  • Adds product:url meta tag sourced from the canonical URL (meta.canonical).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@thiagopereira-vtex
thiagopereira-vtex force-pushed the feat/pdp-product-sku-meta-tag branch from 10233b1 to 7dcf5ac Compare June 8, 2026 21:08

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/CHANGELOG.md`:
- Line 206: Update the changelog entry that begins "Enhance session validation
logic to skip token refresh in local ……" by replacing the double ellipsis
characters (……) with a single ellipsis (…); locate the entry text in the
CHANGELOG content (the line containing "Enhance session validation logic to skip
token refresh in local") and normalize the ellipsis to match the storybook
changelog.
- Line 37: Update the CHANGELOG entry that reads "createNextJSPages throwing
preventing copy of store discovery-co……" to use a single ellipsis character (…)
to match the corresponding entry in packages/storybook/CHANGELOG.md; locate the
line containing that exact text and replace the double ellipsis sequence (……)
with the single ellipsis (…) so formatting is consistent across the monorepo.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 478911dc-fc40-4782-86b9-9b82c2490b42

📥 Commits

Reviewing files that changed from the base of the PR and between 10233b1 and 7dcf5ac.

⛔ Files ignored due to path filters (1)
  • CHANGELOG.md is excluded by none and included by none
📒 Files selected for processing (1)
  • packages/cli/CHANGELOG.md

Comment thread packages/cli/CHANGELOG.md Outdated
### Bug Fixes

- createNextJSPages throwing preventing copy of store discovery-co… ([#3356](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696))
- createNextJSPages throwing preventing copy of store discovery-co…… ([#3356](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Ellipsis formatting inconsistency with storybook changelog.

This line uses double ellipsis (……) but the corresponding entry in packages/storybook/CHANGELOG.md uses a single ellipsis (…). For consistency across the monorepo, these should match.

✏️ Suggested fix
-- createNextJSPages throwing preventing copy of store discovery-co…… ([`#3356`](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696))
+- createNextJSPages throwing preventing copy of store discovery-co… ([`#3356`](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- createNextJSPages throwing preventing copy of store discovery-co…… ([#3356](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696))
- createNextJSPages throwing preventing copy of store discovery-co… ([`#3356`](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/CHANGELOG.md` at line 37, Update the CHANGELOG entry that reads
"createNextJSPages throwing preventing copy of store discovery-co……" to use a
single ellipsis character (…) to match the corresponding entry in
packages/storybook/CHANGELOG.md; locate the line containing that exact text and
replace the double ellipsis sequence (……) with the single ellipsis (…) so
formatting is consistent across the monorepo.

Comment thread packages/cli/CHANGELOG.md Outdated
### Bug Fixes

- Enhance session validation logic to skip token refresh in local … ([#3285](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5))
- Enhance session validation logic to skip token refresh in local …… ([#3285](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Ellipsis formatting inconsistency with storybook changelog.

This line uses double ellipsis (……) but the corresponding entry in packages/storybook/CHANGELOG.md uses a single ellipsis (…). For consistency across the monorepo, these should match.

✏️ Suggested fix
-- Enhance session validation logic to skip token refresh in local …… ([`#3285`](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5))
+- Enhance session validation logic to skip token refresh in local … ([`#3285`](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Enhance session validation logic to skip token refresh in local …… ([#3285](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5))
- Enhance session validation logic to skip token refresh in local … ([`#3285`](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/CHANGELOG.md` at line 206, Update the changelog entry that
begins "Enhance session validation logic to skip token refresh in local ……" by
replacing the double ellipsis characters (……) with a single ellipsis (…); locate
the entry text in the CHANGELOG content (the line containing "Enhance session
validation logic to skip token refresh in local") and normalize the ellipsis to
match the storybook changelog.

@pkg-pr-new

pkg-pr-new Bot commented Jun 8, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@faststore/api

npm i https://pkg.pr.new/vtex/faststore/@faststore/api@46a96aa

@faststore/cli

npm i https://pkg.pr.new/vtex/faststore/@faststore/cli@46a96aa

@faststore/components

npm i https://pkg.pr.new/vtex/faststore/@faststore/components@46a96aa

@faststore/core

npm i https://pkg.pr.new/vtex/faststore/@faststore/core@46a96aa

@faststore/diagnostics

npm i https://pkg.pr.new/vtex/faststore/@faststore/diagnostics@46a96aa

@faststore/lighthouse

npm i https://pkg.pr.new/vtex/faststore/@faststore/lighthouse@46a96aa

@faststore/sdk

npm i https://pkg.pr.new/vtex/faststore/@faststore/sdk@46a96aa

@faststore/ui

npm i https://pkg.pr.new/vtex/faststore/@faststore/ui@46a96aa

commit: 46a96aa

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

},
{
property: 'product:category',
content: itemListElements[0]?.name ?? undefined,
@thiagopereira-vtex
thiagopereira-vtex force-pushed the feat/pdp-product-sku-meta-tag branch 2 times, most recently from 7c3dac6 to f908308 Compare June 8, 2026 21:56
@thiagopereira-vtex
thiagopereira-vtex force-pushed the feat/pdp-product-sku-meta-tag branch from f908308 to 5217af3 Compare June 8, 2026 21:58

@renatomaurovtex renatomaurovtex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean, focused change. The ?? undefined guard on product:category matches the existing product:price:amount pattern at p.tsx:196, so it type-checks and behaves consistently (an empty breadcrumb just renders a content-less meta, same as the existing price tag). product.sku/product.name/meta.canonical are all reliably present on the PDP. Just two non-blocking notes.

packages/core/src/pages/[slug]/p.tsx

💬 [seo] property= vs Open Graph vocabulary

product:sku, product:name, product:category and product:url aren't part of the standard Open Graph product namespace (which uses product:retailer_item_id for SKU, etc.), so OG/social/shopping-feed consumers will ignore them — only the Activity Flow script that reads them by property will pick them up. That's fine for the stated tracking goal; just flagging that the "Open Graph product consumers" benefit in the description won't actually materialize for these four. If feed/OG consumption is a real goal, product:retailer_item_id would be the standard key for SKU.

💬 [test] No test coverage

A *.browser.test.tsx (or snapshot) asserting the four tags render with the right values — and that product:category is omitted/empty when the breadcrumb list is empty — would lock in the behavior. Not strictly required for a metadata-only addition, but cheap to add given the edge case in the description.

Verdict: Approved with comments

Blocking: none.

Non-blocking (💬):

  • The four product:* keys aren't standard OG product properties; they serve the Activity Flow script, not OG consumers.
  • Consider a small test for the rendered tags + the empty-breadcrumb case.

Checks to confirm before merge: pnpm lint · build · pnpm turbo run test --filter=@faststore/core.

@sonar-workflows

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/core/src/pages/[slug]/p.tsx (1)

214-217: ⚡ Quick win

Remove redundant nullish coalescing.

The ?? undefined is redundant here because optional chaining already returns undefined when the array is empty or the property doesn't exist.

♻️ Simplify the expression
         {
           property: 'product:category',
-          content: itemListElements[0]?.name ?? undefined,
+          content: itemListElements[0]?.name,
         },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/pages/`[slug]/p.tsx around lines 214 - 217, Remove the
redundant "?? undefined" for the meta entry where property is
'product:category'; change the value expression to rely on optional chaining
only (use itemListElements[0]?.name) so the content is undefined when
missing—update the object that currently has property: 'product:category' and
content: itemListElements[0]?.name ?? undefined to simply use
itemListElements[0]?.name.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/core/src/pages/`[slug]/p.tsx:
- Around line 214-217: Remove the redundant "?? undefined" for the meta entry
where property is 'product:category'; change the value expression to rely on
optional chaining only (use itemListElements[0]?.name) so the content is
undefined when missing—update the object that currently has property:
'product:category' and content: itemListElements[0]?.name ?? undefined to simply
use itemListElements[0]?.name.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d2598817-f082-4e49-a5df-c1b7d8da5117

📥 Commits

Reviewing files that changed from the base of the PR and between c0c6792 and 46a96aa.

📒 Files selected for processing (1)
  • packages/core/src/pages/[slug]/p.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributing Pull request submitted by the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants