-
Notifications
You must be signed in to change notification settings - Fork 16
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
render json ld to products metadata sheet #105
base: main
Are you sure you want to change the base?
Conversation
} | ||
|
||
if (amount?.value && amount?.currency) { | ||
schema.offers.push({ |
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.
For a SimpleProductView
we can add a single offer like done here. For a ComplexProductView
we should add all available variants.
For this we can use a query like this:
{
variants(sku: "MJ12", optionIds: [], pageSize: 100) {
variants {
selections
product {
sku
inStock
__typename
images(roles: "image") {
url
}
... on SimpleProductView {
price {
...priceFields
}
}
}
}
cursor
}
}
If desired by the customer this could also be limited to specific variant axis (e.g. show color variants, but not the size ones).
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.
I don't think this was done in the client-side setJsonLd so far:
async function setJsonLdProduct(product) { |
Should we update the client side function too?
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.
Good point. I think we were actually waiting for the variants
query to be available on prod CS. If you can re-use the same code, feel free to update PDP as well. Otherwise we can also handle it in a separate issue.
Adds json LD to metadata sheet generation
Test URLs: