module Spree::Core::ControllerHelpers::Store
Public Instance Methods
current_price_options()
click to toggle source
Return a Hash of things that influence the prices displayed in your shop.
By default, the only thing that influences prices that is the current order's tax_zone
(to facilitate differing prices depending on VAT rate for digital products in Europe, see github.com/spree/spree/pull/6295 and github.com/spree/spree/pull/6662).
If your prices depend on something else, overwrite this method and add more key/value pairs to the Hash it returns.
Be careful though to also patch the following parts of Spree
accordingly:
-
`Spree::VatPriceCalculation#gross_amount`
-
`Spree::LineItem#update_price`
-
`Spree::Stock::Estimator#taxation_options_for`
-
Subclass the `DefaultTax` calculator
# File lib/spree/core/controller_helpers/store.rb, line 36 def current_price_options { tax_zone: current_tax_zone } end
current_store()
click to toggle source
# File lib/spree/core/controller_helpers/store.rb, line 12 def current_store @current_store ||= Spree::Store.current(request.env['SERVER_NAME']) end
store_locale()
click to toggle source
# File lib/spree/core/controller_helpers/store.rb, line 16 def store_locale current_store.default_locale end
Private Instance Methods
current_tax_zone()
click to toggle source
# File lib/spree/core/controller_helpers/store.rb, line 44 def current_tax_zone @current_tax_zone ||= @current_order&.tax_zone || Spree::Zone.default_tax end