-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Add support for SalePrice in JSON-LD schema for structured data #52105
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
Add support for SalePrice in JSON-LD schema for structured data #52105
Conversation
Hi , Apart from reviewing the code changes, please make sure to review the testing instructions and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. You can follow this guide to find out what good testing instructions should look like: |
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.
Thanks for opening this PR, @zhyian, this looks really well! Just one question: is there any reason you aren't adding the SalePrice
property to variable products on sale? Variable products where all variations have the same prices, could benefit from this as well, I think.
Thanks @Aljullu for the feedback! Initially, I thought using the @tyrann0us thank you! |
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.
Thanks for the updates, @zhyian! I just noticed one edge case in variables products:
- Set up two variations, one with regular price of
6
and no sale. Another one with regular price of10
and sale price of8
. - Check the page in the validator.
- Notice the price of
6
is presented as theSalePrice
.
My understanding is that it shouldn't, even though it's the lowest price, 6
doesn't belong to a sale so it shouldn't be a SalePrice
.
…operty in variable products on sale
Thank you, @Aljullu, for pointing that out! Great catch - I’ve made the necessary fix. Please take a look. |
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.
Everything looks good on my end now! Thanks for your work, @zhyian! 👏
Hi @zhyian, this update removed the sale price from Yandex search results, only showing the full price – the SalePrice property doesn't come through in the schema for regular products. Looking at the 9.6.0 source it's only applied to variable products – don't know what happened there as your commit seems to include them all. Thanks |
@ivantipov what you are experiencing might be related to another PR (maybe #52871?) so I think it's better if you open a separate issue about this. It would be useful if you can do conflict testing with other plugins before, and then share some steps to reproduce with WooCommerce core that help us reproduce the same issue. I tested with https://webmaster.yandex.com/tools/microtest/, and it's true that when a regular product is on sale we don't include
It's also aligned with what Shopify does, if I'm not wrong. |
Thanks – just added the bug report. |
Submission Review Guidelines:
Changes proposed in this Pull Request:
Closes #51997.
This update adds the
SalePrice
(https://schema.org/SalePrice) property in the JSON-LD schema for structured data. The regular price is moved underListPrice
(https://schema.org/ListPrice) property.This enhancement aligns with recent changes to Google's structured data guidelines for merchant listings, providing more flexibility for representing sale prices. This allows merchants to more effectively showcase discounts and offers in search results.
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
application/ld+json
.Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog Entry Comment
Comment
Add SalePrice property in JSON-LD schema for structured data.