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

fix: Don't render PDP with no price #2142

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/core/src/pages/[slug]/p.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,13 @@ export const getStaticProps: GetStaticProps<

const { data, errors = [] } = searchResult

const hasPrice = data?.product?.offers.offers.some(
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should move this logic to the faststore/api, throwing an isNotFoundError from there.

(offer) => offer.price !== 0
)

const notFound = errors.find(isNotFoundError)

if (notFound) {
if (notFound || !hasPrice) {
return {
notFound: true,
}
Expand Down
Loading