Skip to content

feat: add mpn (manufacturer code) to product's structured data - #3234

Merged
lariciamota merged 1 commit into
devfrom
feat/manufacturer-code
Mar 3, 2026
Merged

lariciamota merged 1 commit into
devfrom
feat/manufacturer-code

Conversation

@lariciamota

@lariciamota lariciamota commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

What's the purpose of this pull request?

Adds the mpn (Manufacturer Part Number) field to the product's structured data (ProductJsonLd). This improves SEO by providing richer product information to search engines via Schema.org Product markup, specifically the mpn property that identifies a product to its manufacturer.

How it works?

The manufacturerCode field from the Intelligent Search response is exposed as mpn on the StoreProduct GraphQL type. It is then queried on the product page and passed to the ProductJsonLd component from next-seo.
It defaults to an empty string for the products that don't have the manufacturerCode field on Catalog.

How to test it?

  • Navigate to any product detail page (PDP).
  • Inspect the page source or use a tool like Schema.org validator.
  • Verify the JSON-LD structured data block includes an "mpn" field with the product's manufacturer code value.
    For products without a manufacturerCode in the IS response, confirm mpn defaults to an empty string without errors.
Screenshot 2026-03-02 at 17 49 26

Starters Deploy Preview

References

Summary by CodeRabbit

Release Notes

  • New Features
    • Products now expose the Manufacturer Part Number (MPN) field in product information and structured data, extending available product metadata.

@lariciamota lariciamota self-assigned this Mar 2, 2026
@lariciamota lariciamota added the enhancement New feature or request label Mar 2, 2026
@coderabbitai

coderabbitai Bot commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8318044 and 3d728da.

⛔ Files ignored due to path filters (3)
  • packages/api/src/__generated__/schema.ts is excluded by !**/__generated__/** and included by packages/**
  • packages/core/@generated/gql.ts is excluded by !**/@generated/**, !**/@generated/** and included by packages/**
  • packages/core/@generated/graphql.ts is excluded by !**/@generated/**, !**/@generated/** and included by packages/**
📒 Files selected for processing (4)
  • packages/api/src/platforms/vtex/clients/search/types/ProductSearchResult.ts
  • packages/api/src/platforms/vtex/resolvers/product.ts
  • packages/api/src/typeDefs/product.graphql
  • packages/core/src/pages/[slug]/p.tsx

Walkthrough

The changes introduce manufacturer part number (MPN) support across the API stack. A new optional manufacturerCode property is added to product search results, mapped to an mpn GraphQL field, and integrated into product pages for structured data output.

Changes

Cohort / File(s) Summary
Type & Schema Extensions
packages/api/src/platforms/vtex/clients/search/types/ProductSearchResult.ts, packages/api/src/typeDefs/product.graphql
Added manufacturerCode?: string to Product interface and mpn: String! field to StoreProduct GraphQL type, extending the data model surface.
Resolver Implementation
packages/api/src/platforms/vtex/resolvers/product.ts
New mpn resolver extracts manufacturerCode from isVariantOf with fallback to empty string.
Frontend Integration
packages/core/src/pages/[slug]/p.tsx
Query extended to fetch mpn field and wired into ProductJsonLd for structured data output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • gabpaladino
  • eduardoformiga
  • lucasfp13

Poem

🏭 A manufacturer code takes flight,
Through types and resolvers, shining bright,
Into the schema, queries unfold,
MPN data, a story told,
✨ SEO structured, pure delight!

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding the mpn field to product's structured data to expose manufacturer codes for SEO purposes.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/manufacturer-code

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 Mar 2, 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.

@lariciamota
lariciamota marked this pull request as ready for review March 2, 2026 20:51
@lariciamota
lariciamota requested a review from a team as a code owner March 2, 2026 20:51
@lariciamota
lariciamota requested review from lucasfp13 and ommeirelles and removed request for a team March 2, 2026 20:51

@lucasfp13 lucasfp13 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.

💯

@lariciamota
lariciamota merged commit 9597e39 into dev Mar 3, 2026
5 checks passed
@lariciamota
lariciamota deleted the feat/manufacturer-code branch March 3, 2026 14:02
thiagopereira-vtex pushed a commit that referenced this pull request Mar 10, 2026
## What's the purpose of this pull request?

Adds the mpn (Manufacturer Part Number) field to the product's
structured data (`ProductJsonLd`). This improves SEO by providing richer
product information to search engines via Schema.org Product markup,
specifically the mpn property that identifies a product to its
manufacturer.

## How it works?

The `manufacturerCode` field from the Intelligent Search response is
exposed as `mpn` on the `StoreProduct` GraphQL type. It is then queried
on the product page and passed to the `ProductJsonLd` component from
next-seo.
It defaults to an empty string for the products that don't have the
`manufacturerCode` field on Catalog.

## How to test it?

- Navigate to any product detail page (PDP).
- Inspect the page source or use a tool like [Schema.org
validator](https://validator.schema.org/).
- Verify the JSON-LD structured data block includes an "mpn" field with
the product's manufacturer code value.
For products without a manufacturerCode in the IS response, confirm mpn
defaults to an empty string without errors.
<img width="700" alt="Screenshot 2026-03-02 at 17 49 26"
src="https://github.com/user-attachments/assets/93672130-6ecf-4c88-bb4d-db55f49b5090"
/>

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

## References

- [Jira task](https://vtex-dev.atlassian.net/browse/SO-543)
- [Slack
thread](https://vtex.slack.com/archives/C05JYQJ94F8/p1755206247400689?thread_ts=1754663648.632859&cid=C05JYQJ94F8)
- [Slack thread
2](https://vtex.slack.com/archives/C03L3CRCDC4/p1772483451655209)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **New Features**
* Products now expose the Manufacturer Part Number (MPN) field in
product information and structured data, extending available product
metadata.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants