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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Reduce the number of SQL on PDP to generate breadcrumbs
Damian Legawiec02829acda0d5
diff --git a/storefront/app/helpers/spree/products_helper.rb b/storefront/app/helpers/spree/products_helper.rbindex ede0805063..22e6b16320 100644--- a/storefront/app/helpers/spree/products_helper.rb+++ b/storefront/app/helpers/spree/products_helper.rb@@ -146,9 +146,10 @@ module Spreeenddef product_breadcrumb_taxons(product)- return Spree::Taxon.none if product.taxons.empty?+ return Spree::Taxon.none if product.main_taxon.blank?- product.main_taxon.self_and_ancestors.where.not(depth: 0)+ # using find_all as we already iterate over the taxons in #product_json_ld_breadcrumbs+ product.main_taxon.self_and_ancestors.find_all { |taxon| taxon.depth != 0 }enddef product_list_json_ld_elements(product_slugs)