-
Notifications
You must be signed in to change notification settings - Fork 921
Store Product Schema Data in a Transient #22082
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
Comments
Hi @BFTrick Thanks for creating the issue. As you have tested this on the staging site (from the video), can you please confirm whether the same can be replicated on the live site? If the staging site is not set with the WP_ENVIRONMENT_TYPE and if it's set as production, can you please confirm whether the SEO Data Optimization is already completed within the Yoast SEO > Tools page? I am asking this because, on the staging site, the SEO Data Optimization won't be completed as we restrict the creation of indexable over it. When the indexable is not created on a staging site, generating the schema and meta tags will take some time to process the data from the database. We look forward to hearing from you more on this. |
On Production we've optimized our data On my local environment it's greyed out. We sanitize our production DB and regularly pull it into our test environments. Question: is it possible to confirm if the data is optimized in my local environment (even with the button greyed out)?
We unfortunately, don't have profiling on our production site. 😦 However, from an audit, our host did actually cowboy coded a quick fix disabling Yoast and they saw similar results.
|
Hi @BFTrick Thanks for sharing the details. What's next? |
Hey @josevarghese This is high priority for us. We're looking to improve performance by adding transient-based caching to Yoast’s schema output. 🙋 Before submitting a formal PR, we’d like to confirm whether this approach aligns with your team’s architecture preferences. 🔄 Two Transient ApproachesLooking at:
🔁 Cache InvalidationWe plan to clear transients on Something simple like this: function clear_yoast_schema_cache($post_id) {
delete_transient('yoast_schema_raw_product_' . $post_id);
delete_transient('yoast_schema_' . $post_id);
}
add_action('save_post', 'clear_yoast_schema_cache'); Post TypesThe core of our problem comes from Variable Products in WooCommerce with 90+ variations. This might not be necessary for blog posts, pages, and other posts. Two more choices:
I'm leaning towards just adding transients for products for now. Pros:
🙋 If your dev team can give us some direction. I'm happy to write a PR & test it. |
Hi @BFTrick Thank you for taking the time to share your detailed approach with us. I've passed it to our development team for their review and feedback. I'll update you once I hear back from them. Alternatively, our development team may comment here directly with further feedback. |
Internal Slack conversation: https://yoast.slack.com/archives/C01NCRHHN30/p1747043963654449 |
Is your feature request related to a problem? Please describe.
We're doing some performance audits our WooCommerce site.
One of the items raised was the time to generate structured data for each WooCommerce Product. 🕐
With some profiling tools (Blackfire.io) disabling Yoast's structured data saves us ~1.6s to load the page (once you've added a product to the cart and you're bypassing the cache).
We obviously want to keep the structured data. It's helpful for SEO.
But we don't want every user who has a product in their cart to have to wait 1.6s to load structured data (for robots) instead of viewing the product page and adding more products to their cart and checking out.
Here's a 10-min video showing you our profiling tools and how I came up with the 1.6s number: https://youtu.be/EFxhie7VohA
Describe the solution you'd like
Is there a way to save this data in a transient? Or some other mechanism?
Is there a way to optimize this functionality for stores like ours? It seems like there's a lot of repeated images in the structured data.
Here's a diff with structured data on the left (in dev mode) and no structured data on the right: https://www.diffchecker.com/K6YIZyhN/
Why do you think this feature is something we should consider for the Yoast SEO plugins?
Virtually every WooCommerce store could increase their conversion rates & make shoppers happier for uncached pages if we can skip generating structured data on every page load.
Additional context
Here are the two filters I used for testing
add_filter( 'yoast_seo_development_mode', '__return_true' );
add_filter( 'wpseo_json_ld_output', '__return_false' );
We use Variable Products in WooCommerce. The product in question has 6 styles & 16 sizes per style. So there's 96 variations on this page.
So looping through this functionality ~100 times is probably the cause and why smaller sites might not notice the processing time.
The text was updated successfully, but these errors were encountered: