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
Fixed: don't update tracking params in checkout if they didn't change (#13404)
Damian Legawiece456f46d8e52
diff --git a/storefront/app/controllers/spree/checkout_controller.rb b/storefront/app/controllers/spree/checkout_controller.rbindex 37fcff211d..090ec79622 100644--- a/storefront/app/controllers/spree/checkout_controller.rb+++ b/storefront/app/controllers/spree/checkout_controller.rb@@ -196,8 +196,14 @@ module Spree# completed orders shouldn't be updated anymoreunless @order.completed?- @order.assign_attributes(order_tracking_params)- @order.update_columns(order_tracking_params)+ tracking_params = order_tracking_params+ changed_params = tracking_params.reject { |key, value| @order.public_send(key) == value }++ if changed_params.any?+ @order.assign_attributes(changed_params)+ @order.update_columns(changed_params)+ end+@order.associate_user!(try_spree_current_user) if try_spree_current_user && @order.user.nil?end@current_order = @order # for compatibility with the rest of storefront, analytics, etcdiff --git a/storefront/app/helpers/spree/checkout_analytics_helper.rb b/storefront/app/helpers/spree/checkout_analytics_helper.rbindex 4f7ca5b3de..2a55faf110 100644--- a/storefront/app/helpers/spree/checkout_analytics_helper.rb+++ b/storefront/app/helpers/spree/checkout_analytics_helper.rb@@ -19,12 +19,9 @@ module Spreeenddef order_tracking_params- tracking_params = {+ {last_ip_address: request.remote_ip,}-- tracking_params[:ahoy_visit_id] = current_visit.id if @order.respond_to?(:ahoy_visit) && defined?(current_visit) && current_visit&.id- tracking_paramsenddef track_checkout_started