Skip to content

feat: Enable fraction digit formatting for SEO's product:price:amount meta tag#3179

Merged
lucasfp13 merged 4 commits intodevfrom
feat/custom-price-amount-seo-tag
Jan 27, 2026
Merged

feat: Enable fraction digit formatting for SEO's product:price:amount meta tag#3179
lucasfp13 merged 4 commits intodevfrom
feat/custom-price-amount-seo-tag

Conversation

@hellofanny
Copy link
Copy Markdown
Contributor

@hellofanny hellofanny commented Jan 19, 2026

What's the purpose of this pull request?

With these changes, merchants will be able to choose the the minimum price fraction digits to be used on SEO's product price meta tag, preventing mismatch values between displayed product price and SEO's product:price:amount.

How to test it?

Check if the displayed price for any product matches with the SEO's product:price:amount meta tag.

Starters Deploy Preview

Summary by CodeRabbit

  • New Features
    • Product price meta tags (used by search engines and social previews) now support configurable decimal precision, producing consistently formatted price values for improved SEO and display.
    • When no precision is set, prices fall back to previous default formatting to preserve existing behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 19, 2026

Walkthrough

Adds seo.pdp.minPriceAmountFractionDigits to default config and uses it to conditionally format the product price metatag (via toFixed) on the PDP; also includes a minor import reordering.

Changes

Cohort / File(s) Summary
Config
packages/core/discovery.config.default.js
Added seo.pdp.minPriceAmountFractionDigits: undefined to exported configuration.
PDP page
packages/core/src/pages/[slug]/p.tsx
Compute productPriceAmountMetatag from product.offers.lowPrice; if pdpSeo.minPriceAmountFractionDigits is a number use toFixed(...), otherwise use toString(). Reordered import: getComponentKey moved within imports.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

✨ A tiny config to guide the cents,
Decimals trimmed with prudent sense,
Meta tags neat, the price aligns,
A small tweak humming in the lines.

🚥 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: enabling fraction digit formatting for the SEO product:price:amount meta tag, which directly aligns with the changeset's core functionality.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Jan 19, 2026

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.

@lucasfp13 lucasfp13 changed the title chore: enables sets formatter for product price metatag feat: Enable fraction digit formatting for SEO's product price metatag Jan 25, 2026
@lucasfp13 lucasfp13 changed the title feat: Enable fraction digit formatting for SEO's product price metatag feat: Enable fraction digit formatting for SEO's product:price:amount meta tag Jan 25, 2026
@lucasfp13 lucasfp13 marked this pull request as ready for review January 25, 2026 21:12
@lucasfp13 lucasfp13 requested a review from a team as a code owner January 25, 2026 21:12
@lucasfp13 lucasfp13 requested review from gabpaladino and lucasfp13 and removed request for a team January 25, 2026 21:12
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/core/src/pages/`[slug]/p.tsx:
- Around line 109-118: The current guard treats 0 as falsy and may pass an
out-of-range value to Number.prototype.toFixed, causing SSR errors; update the
check around productPriceAmountMetatag to allow product.offers.lowPrice === 0 by
testing for lowPrice != null and to validate pdpSeo.minPriceFractionDigits with
typeof === 'number' and clamp it to the safe toFixed range (0–20) before calling
toFixed (or skip formatting if the number is out of range), referencing
productPriceAmountMetatag, product.offers.lowPrice,
pdpSeo.minPriceFractionDigits and the toFixed call so the formatted string is
produced safely.

Comment thread packages/core/src/pages/[slug]/p.tsx
Copy link
Copy Markdown
Member

@eduardoformiga eduardoformiga left a comment

Choose a reason for hiding this comment

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

Do we need to ask the education team to document this new option?

Copy link
Copy Markdown
Contributor Author

@hellofanny hellofanny left a comment

Choose a reason for hiding this comment

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

nice!
Just to emphasize I think we should be using default and the usage of this prop is in a very specific context (customization of the schema, we could add this note and scenario in the doc to be clear)

@lucasfp13 lucasfp13 merged commit d6e6252 into dev Jan 27, 2026
4 of 5 checks passed
@lucasfp13 lucasfp13 deleted the feat/custom-price-amount-seo-tag branch January 27, 2026 13:27
This was referenced Feb 3, 2026
thiagopereira-vtex pushed a commit that referenced this pull request Mar 10, 2026
…t` meta tag (#3179)

## What's the purpose of this pull request?

With these changes, merchants will be able to choose the the minimum
price fraction digits to be used on SEO's product price meta tag,
preventing mismatch values between displayed product price and SEO's
`product:price:amount`.

## How to test it?

Check if the displayed price for any product matches with the SEO's
`product:price:amount` meta tag.

### Starters Deploy Preview

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

* **New Features**
* Product price meta tags (used by search engines and social previews)
now support configurable decimal precision, producing consistently
formatted price values for improved SEO and display.
* When no precision is set, prices fall back to previous default
formatting to preserve existing behavior.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Lucas Feijó <lucas.portela@vtex.com>
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.

4 participants