Sha256: 3d80dfdf250fa577cbe8b6edb6e4db36e1d9319b32b1ad23daacb82cdaa20b42

Contents?: true

Size: 644 Bytes

Versions: 2

Compression:

Stored size: 644 Bytes

Contents

module Spree
  class CurrencyController < StoreController
    def set
      @currency = supported_currencies.find { |currency| currency.iso_code == params[:currency] }
      # Make sure that we update the current order, so the currency change is reflected.
      current_order&.update(currency: @currency.iso_code)
      session[:currency] = params[:currency] if Spree::Config[:show_store_selector]
      respond_to do |format|
        format.json { render json: !@currency.nil? }
        format.html do
          # We want to go back to where we came from!
          redirect_back_or_default(root_path)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_frontend-4.2.0.rc5 app/controllers/spree/currency_controller.rb
spree_frontend-4.2.0.rc4 app/controllers/spree/currency_controller.rb