Skip to content

feat(reviews): conditionally display reviews based on display settings#2754

Merged
matthewvolk merged 1 commit intocanaryfrom
CATALYST-1575-show-product-rating-ui
Dec 11, 2025
Merged

feat(reviews): conditionally display reviews based on display settings#2754
matthewvolk merged 1 commit intocanaryfrom
CATALYST-1575-show-product-rating-ui

Conversation

@matthewvolk
Copy link
Copy Markdown
Contributor

Warning

Depends on #2752 and #2753

What/Why?

Conditionally display product ratings based on site.settings.display.showProductRating. Ratings only show when both reviews.enabled and display.showProductRating are true, matching Stencil + Cornerstone behavior.

Updates brand, category, search, and product pages to query and respect the display setting. Product detail page separates review form visibility (reviewsEnabled) from rating display (showRating).

Testing

  • Verify ratings appear on product cards when showProductRating is enabled
  • Verify ratings are hidden when showProductRating is disabled
  • Verify review form remains functional regardless of rating display setting
  • Test across brand, category, search, and product detail pages
reviews-enabled-show-rating-disabled.mov
reviews-enabled-show-rating-enabled.mov
reviews-disabled.mov

Migration

No migration needed. This adds a new GraphQL field (display.showProductRating) and conditional logic. Existing behavior unchanged if setting not configured.

Note: This pull request description was generated with the assistance of AI.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Dec 8, 2025

🦋 Changeset detected

Latest commit: 77c1e77

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
catalyst-b2b Ready Ready Preview Comment Dec 11, 2025 10:27pm
catalyst-canary Ready Ready Preview Comment Dec 11, 2025 10:27pm
2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
catalyst Ignored Ignored Dec 11, 2025 10:27pm
catalyst-uplift-vertex Ignored Ignored Dec 11, 2025 10:27pm

Copy link
Copy Markdown
Contributor Author

@matthewvolk matthewvolk left a comment

Choose a reason for hiding this comment

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

Note + question I had while working on this one

const baseProduct = await getProduct(productId, customerAccessToken);
const { product: baseProduct, settings } = await getProduct(productId, customerAccessToken);

const reviewsEnabled = Boolean(settings?.reviews.enabled && !settings.display.showProductRating);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this var name is confusing... it's supposed to represent that reviews can still be left on a product even if the merchant has disabled "Show product ratings on my store" in their display settings.

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.

reviewSubmissionEnabled? 🍹

Comment on lines +61 to +69
reviewFormEmailLabel?: string;
reviewFormModalTitle?: string;
reviewFormNameLabel?: string;
reviewFormRatingLabel?: string;
reviewFormReviewLabel?: string;
reviewFormSubmitLabel?: string;
reviewFormTitleLabel?: string;
reviewFormAction: SubmitReviewAction;
user: Streamable<{ email: string; name: string }>;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

New props required to render ReviewForm ("Write a review" form) when Review Display setting is disabled, but Product Review functionality is enabled (this is done to match Stencil behavior)

Copy link
Copy Markdown
Contributor

@bookernath bookernath left a comment

Choose a reason for hiding this comment

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

Non-blocking comments, most important is probably to have a think about how international names may be affected by "first + last initial" treatment (will that ever break?)

const baseProduct = await getProduct(productId, customerAccessToken);
const { product: baseProduct, settings } = await getProduct(productId, customerAccessToken);

const reviewsEnabled = Boolean(settings?.reviews.enabled && !settings.display.showProductRating);
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.

reviewSubmissionEnabled? 🍹

const firstName = session?.user?.firstName ?? '';
const lastName = session?.user?.lastName ?? '';

if (!firstName || !lastName) {
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.

consider if (!firstName && !lastName) 🍹

crazy edge case but suppose only one name was populated... is that still a valid user?

return { email: session?.user?.email ?? '', name: '' };
}

const lastInitial = lastName.charAt(0).toUpperCase();
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.

🍹 internationalization considerations?

@matthewvolk matthewvolk force-pushed the CATALYST-1575-show-product-rating-ui branch from 5c4934f to 77c1e77 Compare December 11, 2025 22:24
@matthewvolk matthewvolk added this pull request to the merge queue Dec 11, 2025
Merged via the queue into canary with commit 4cbc124 Dec 11, 2025
12 checks passed
@matthewvolk matthewvolk deleted the CATALYST-1575-show-product-rating-ui branch December 11, 2025 22:39
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.

3 participants