Introduce User Group Pricing to the price selector Price Selector#23
Open
JustShah wants to merge 3 commits into
Open
Conversation
aaff3a6 to
5920ded
Compare
f2dfdd5 to
7fd98de
Compare
5920ded to
d98c8f2
Compare
7fd98de to
913a236
Compare
d98c8f2 to
fd0982d
Compare
913a236 to
241ef35
Compare
fd0982d to
cb53a85
Compare
241ef35 to
bd89891
Compare
cb53a85 to
9a2d49a
Compare
bd89891 to
4f039e0
Compare
9a2d49a to
b422769
Compare
A new scope `without_pricelist` in the `Spree::Price` model to allow filtering of prices that are not associated with any price list. The purpose of this change is to allow the system to differentiate between prices that are managed by price lists and those that are not. This scope is useful for filtering and querying prices that should be treated as standalone (i.e., not tied to a price list).
…ptions Introduced Spree::Variant::PricingOptionsWithUserGroup, a class that defines the necessary pricing attributes (currency, country, user group) for selecting prices. The reason for adding this class is to provide a flexible way of defining pricing options that consider user groups, alongside other factors such as country and currency. By incorporating user group information into pricing options, we can manage more complex pricing models where different user groups may receive different pricing for the same product variant.
The class Spree::Variant::PriceSelectorByUserGroup, which selects the appropriate price for a product variant based on user group pricing options. The primary reason for this change is to allow for user group-specific pricing by incorporating a class that can dynamically select the correct price based on user group and other pricing options (such as country and currency). This facilitates the implementation of price differentiation for various customer segments. The class can be used by setting ``` Spree.config do |config| config.variant_price_selector_class = 'Spree::Variant::PriceSelectorByUserGroup end ``` in `config/initializers/spree.rb`
4f039e0 to
e741a9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Overview:
This pull request introduces enhancements to the pricing system in the Spree application by implementing user group-specific pricing. The changes allow for dynamic price selection based on user groups, enabling more flexible and differentiated pricing strategies for various customer segments.
Key Changes:
Price Selector by User Group:
Spree::Variant::PriceSelectorByUser Groupclass, which is responsible for selecting the appropriate price for a product variant based on user group pricing options.Pricing Options with User Group:
Spree::Variant::PricingOptionsWithUser Groupclass to define the necessary pricing attributes (currency, country, user group) for selecting prices.New Scope in Price Model:
without_pricelistscope to theSpree::Pricemodel, enabling filtering of prices that are not associated with any price list.Benefits: