Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add Fragment Caching to _json_ld_variant.html.erb (#13020)

Umesh Ravanice4380d73054
diff --git a/storefront/app/views/themes/default/spree/products/_json_ld_variant.html.erb b/storefront/app/views/themes/default/spree/products/_json_ld_variant.html.erb
index c26b011ef8..2ff304e36f 100644
--- a/storefront/app/views/themes/default/spree/products/_json_ld_variant.html.erb
+++ b/storefront/app/views/themes/default/spree/products/_json_ld_variant.html.erb
@@ -1,3 +1,4 @@
+<% cache ["json-ld-variant", spree_base_cache_scope, variant.cache_key_with_version] do %>
{
"@type": "Offer",
<% if variant.sku.present? %>
@@ -8,3 +9,4 @@
"priceCurrency": <%= current_currency.to_json.html_safe %>,
"url": <%= spree.product_url(product, variant_id: variant.id, host: current_store.url_or_custom_domain).to_json.html_safe %>
}
+<% end %>