Sha256: 6dc2b16b755466cb9a5f60ae354e1b64fb727f1af9ec3b1d0fa7e5813bd92d11

Contents?: true

Size: 665 Bytes

Versions: 1

Compression:

Stored size: 665 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_attributes!(currency: @currency.iso_code)
      session[:currency] = params[:currency] if Spree::Config[:show_store_currency_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

1 entries across 1 versions & 1 rubygems

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