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
Allow easily to override variant includes in Storefront API Products … (#13055)
Damian Legawiec64024c118b6e
diff --git a/api/app/controllers/spree/api/v2/storefront/products_controller.rb b/api/app/controllers/spree/api/v2/storefront/products_controller.rbindex 90b1d5fb52..21bf92cb1d 100644--- a/api/app/controllers/spree/api/v2/storefront/products_controller.rb+++ b/api/app/controllers/spree/api/v2/storefront/products_controller.rb@@ -16,14 +16,15 @@ module Spreeenddef resource- # fixed N+1 queries issue- variant_includes = [+ # using FriendlyId so old slugs still work+ @resource ||= find_with_fallback_default_locale { scope.includes(variants: variant_includes, master: variant_includes).friendly.find(params[:id]) } || scope.includes(variants: variant_includes, master: variant_includes).friendly.find(params[:id])+ end++ def variant_includes+ [:prices,{ option_values: [:option_type] }]-- # using FriendlyId so old slugs still work- @resource ||= find_with_fallback_default_locale { scope.includes(variants: variant_includes, master: variant_includes).friendly.find(params[:id]) } || scope.includes(variants: variant_includes, master: variant_includes).friendly.find(params[:id])enddef collection_sorter