-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add support for ListPrice and priceValidUntil in JSON-LD #39
Conversation
const image = this.product.images?.[0]?.url | ||
?? findProductImage(this.product, this.variants)?.url; | ||
const configurableProduct = this.variants && this.variants.length > 0; | ||
const offers = configurableProduct ? this.variants : [this.product]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer adding the parent product as an offer. Will only use variants or product if no variants exist
src/content/queries/cs-variants.js
Outdated
if (specialToDate) { | ||
const today = new Date(); | ||
const specialPriceToDate = new Date(specialToDate); | ||
if (specialPriceToDate.getTime() >= today.getTime()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not 100% sure if we should filter this out if the sale has passed. This is what bulk does though. Also wondering about timezones..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, not a huge fan since we wouldn't actually be publishing when the offer elapses, but seems like an edge case that shouldn't happen anyway.. worth keeping in mind for the publish triggering topic though
src/content/queries/cs-variants.js
Outdated
@@ -49,6 +49,16 @@ export const adapter = (config, variants) => variants.map(({ selections, product | |||
}, | |||
selections: selections ?? [], | |||
}; | |||
|
|||
const specialToDate = product.attributes?.find((attr) => attr.name === 'special_to_date')?.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
special_to_date
is a core attribute. So I think we are safe to use this as the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this attribute exist on the variant? or on the product?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we are pulling for the variant, but good point.. In the case of a simple product maybe we should also add for the product.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
src/content/queries/cs-variants.js
Outdated
if (specialToDate) { | ||
const today = new Date(); | ||
const specialPriceToDate = new Date(specialToDate); | ||
if (specialPriceToDate.getTime() >= today.getTime()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, not a huge fan since we wouldn't actually be publishing when the offer elapses, but seems like an edge case that shouldn't happen anyway.. worth keeping in mind for the publish triggering topic though
🎉 This PR is included in version 1.5.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
No description provided.