-
-
Notifications
You must be signed in to change notification settings - Fork 731
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
New variants should inherit tax category in UI #13068
base: master
Are you sure you want to change the base?
New variants should inherit tax category in UI #13068
Conversation
19ba678
to
87eea13
Compare
87eea13
to
d381ceb
Compare
@@ -14,6 +14,7 @@ def prepare_new_variant(product, producer_options) | |||
# e.g producer_options = [['producer name', id]] | |||
product.variants.build do |new_variant| | |||
new_variant.supplier_id = producer_options.first.second if producer_options.one? | |||
new_variant.tax_category_id = product.variants.first.tax_category_id |
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.
worth adding a check to see if variant exists? Ive noted in UI that a minimum of one variant always exists
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.
The UI prevents you from deleting a variant if there is only one left, and currently when creating a new product a variant will be created by default. So I think it's fair to assume there will always be one variant.
d381ceb
to
1586c8e
Compare
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.
Looks good 👍 Thanks for your help @vishaldeepak 🙏
@@ -14,6 +14,7 @@ def prepare_new_variant(product, producer_options) | |||
# e.g producer_options = [['producer name', id]] | |||
product.variants.build do |new_variant| | |||
new_variant.supplier_id = producer_options.first.second if producer_options.one? | |||
new_variant.tax_category_id = product.variants.first.tax_category_id |
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.
The UI prevents you from deleting a variant if there is only one left, and currently when creating a new product a variant will be created by default. So I think it's fair to assume there will always be one variant.
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.
Nice. Thank you!
What? Why?
Creation of a new variant was setting tax category as none. This is problematic for any hub selling taxable products. The fix is on creating a new variant in the UI it should set tax category from the first variant.
What should we test?
After changes it should behave similar to below
opennetwork.mov
Release notes
Changelog Category (reviewers may add a label for the release notes):
The title of the pull request will be included in the release notes.
Dependencies
Documentation updates