-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow configuring VAT Price Generator class #3451
Allow configuring VAT Price Generator class #3451
Conversation
It is common that stores need to configure how VAT is calculated and we should provide an easy extension point to make this change as clean as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good!
I have a suggestion though: Given that this requirement is quite common (and also given that the example we give in this PR matches Spree's VAT logic!), we might want to ship both classes within core, maybe with these class names:
Spree::Variant::ConstantNetVatPricegenerator
(aliased to the currentSpree::Variant::VatPriceGenerator
)Spree::Variant::ContantGrossVatPriceGenerator
(the implementation from the docs in this PR)?
That's a great idea. Wondering if this should be done at a TaxRate level. I mean when we decide that a tax rate is incuded in price we could also give admin the ability to choose if they want it constant net or constant gross. Do you think it makes sense this way? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kennyadsl thanks 👍
Description
The current VAT generation logic provided by Solidus is not flexible enough to match any business needs, see #3448.
This PR allows to easily create your own custom class to generate VAT prices and use it in Solidus. It also adds a simple explanation in Guides with a realistic example, taken from the issue mentioned above.
Checklist:
[ ] I have added tests to cover this change (if needed)[ ] I have attached screenshots to this PR for visual changes (if needed)