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.

Fixed last checkout issues

Damian Legawiec32b93a8d36df
diff --git a/storefront/app/controllers/spree/checkout_controller.rb b/storefront/app/controllers/spree/checkout_controller.rb
index 682ca94588..8637f02c49 100644
--- a/storefront/app/controllers/spree/checkout_controller.rb
+++ b/storefront/app/controllers/spree/checkout_controller.rb
@@ -13,7 +13,6 @@ module Spree
before_action :ensure_order_not_completed, only: [:edit, :update]
before_action :ensure_checkout_allowed
- before_action :ensure_valid_totals, only: [:edit]
before_action :ensure_valid_state, only: [:edit, :update]
before_action :restart_checkout, only: :edit, if: :should_restart_checkout?
@@ -236,10 +235,6 @@ module Spree
redirect_to spree.checkout_state_path(@order.token, @order.state, _gl: params[:_gl].presence)
end
- def ensure_valid_totals
- @order.ensure_valid_totals if correct_state.in?(%w(address delivery))
- end
-
def should_restart_checkout?
(@order.quick_checkout? || @order.ship_address.nil?) && (@order.delivery? || @order.payment?)
end
diff --git a/storefront/spec/controllers/spree/checkout_controller_spec.rb b/storefront/spec/controllers/spree/checkout_controller_spec.rb
index fa5a9e36c8..282d074dfc 100644
--- a/storefront/spec/controllers/spree/checkout_controller_spec.rb
+++ b/storefront/spec/controllers/spree/checkout_controller_spec.rb
@@ -118,11 +118,9 @@ describe Spree::CheckoutController, type: :controller do
let(:user) { create(:user) }
it 'redirects to cart page' do
- store.update(url: "http://#{store.code}.#{Spree.root_domain}")
-
get :edit, params: { token: order.token }
expect(flash[:error]).to eq('You cannot access this checkout')
- expect(response).to redirect_to(spree.cart_url(host: store.url))
+ expect(response).to redirect_to(spree.cart_path)
end
end
end