Class: SolidusConfigurableKits::PriceSelector
- Inherits:
-
Spree::Variant::PriceSelector
- Object
- Spree::Variant::PriceSelector
- SolidusConfigurableKits::PriceSelector
- Defined in:
- app/services/solidus_configurable_kits/price_selector.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#price_for(price_options) ⇒ Spree::Money?
The variant’s price, given a set of pricing options.
-
#price_for_options(price_options) ⇒ Spree::Price?
The variant’s Spree::Price record, given a set of pricing options.
Class Method Details
.pricing_options_class ⇒ Object
5 6 7 |
# File 'app/services/solidus_configurable_kits/price_selector.rb', line 5 def self. SolidusConfigurableKits::PricingOptions end |
Instance Method Details
#price_for(price_options) ⇒ Spree::Money?
The variant’s price, given a set of pricing options
12 13 14 15 16 17 18 19 20 |
# File 'app/services/solidus_configurable_kits/price_selector.rb', line 12 def price_for() ::Spree::Deprecation.warn( "price_for is deprecated and will be removed. The price_for method should return a Spree::Price as described. Please use #price_for_options and adjust your frontend code to explicitly call &.money where required" ) ()&.money end |
#price_for_options(price_options) ⇒ Spree::Price?
The variant’s Spree::Price record, given a set of pricing options
25 26 27 28 29 30 31 32 |
# File 'app/services/solidus_configurable_kits/price_selector.rb', line 25 def () variant.currently_valid_prices.detect do |price| (price.country_iso == .desired_attributes[:country_iso] || price.country_iso.nil? ) && price.currency == .desired_attributes[:currency] && price.kit_item == .desired_attributes[:kit_item] end end |