Skip to content
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

Feature/add usergroupid for product tax calculation #3245

Conversation

ResuBaka
Copy link
Collaborator

I have updated the calculateProductTax to get the new feature to work.
This does only work when you set the tax.userGroupId to a number and have sourcePriceIncludesTax and calculateServerSide set to false.

Short description and why it's useful

This is adds tax calculation with product_tax_class_ids and customer_tax_class_ids.
We had the problem that when only the product_tax_class_ids we get the wrong taxes on a product to so we need to use both product_tax_class_ids and customer_tax_class_ids to get the right tax class for a product.

Which environment this relates to

Check your case. In case of any doubts please read about Release Cycle

  • Test version (https://test.storefrontcloud.io) - this is a new feature or improvement for Vue Storefront. I've created branch from develop branch and want to merge it back to develop
  • RC version (https://next.storefrontcloud.io) - this is a stabilisation fix for Release Candidate of Vue Storefront. I've created branch from release branch and want to merge it back to release
  • Stable version (https://demo.storefrontcloud.io) - this is an important fix for current stable version. I've created branch from hotfix or master branch and want to merge it back to hotfix

Upgrade Notes and Changelog

  • No upgrade steps required (100% backward compatibility and no breaking changes)
  • I've updated the Upgrade notes and Changelog on how to port existing VS sites with this new feature

IMPORTANT NOTICE - Remember to update CHANGELOG.md with description of your change

Contribution and currently important rules acceptance

@pkarw
Copy link
Collaborator

pkarw commented Jul 17, 2019

Cool; but two more things:

Copy link
Collaborator

@pkarw pkarw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do apply this logic to vue-storefront-api as well + add the support for dynamic groupId

@ResuBaka
Copy link
Collaborator Author

Did something change in vue-storefront because when I use my local Installation 1.9.0-rc2 then $vm0.$store.state.user.current.group_id is set but $vm0.$store.state.user.groupId is null.
Is that maybe something which is not set because we use magento1? @pkarw

For the api I would make an Issue for or i need to see how much time I have to work on it.

Then what do you mean by dynamic groupId?

@pkarw
Copy link
Collaborator

pkarw commented Jul 17, 2019

To be poerfectly honest with you - I'm not sure how this is being set :) @mdanilowicz was in charge of tier prices few months ago and add this dynamic groups mechanism by this change. But youre' right the group_id property should be on user as well so we could use it - but please just make sure it's the same with m2 and m1 as well

@ResuBaka
Copy link
Collaborator Author

I just found out to things first $vm0.$store.state.user.groupId is only set with the user.current.group_id when usePriceTiers is set to true and magento1 and magento2 has both user.current.group_id set.

The second one is that we need to redo all our tax calculation when a user login and his groupId is different from the one that is in the config.

@ResuBaka
Copy link
Collaborator Author

ResuBaka commented Jul 19, 2019

I need to change the code of PriceTiers a bit as I need to use the user groupId/groupToken as well and not only PriceTiers alone.

So we need to test that too after I am finished with the implementation.

…tion

Moved checks and user group id into functions to reused that code at some more
places.
…tion

Moved checks and user group id into functions to reused that code at some more
places.
…eature/add-usergroupid-for-product-tax-calculation
@ResuBaka
Copy link
Collaborator Author

The PR for adding this also to the API can be found here.

@pkarw pkarw requested a review from patzick July 22, 2019 13:28
@patzick patzick added this to the 1.11.0-rc.1 milestone Jul 23, 2019
@patzick patzick merged commit 53d79f7 into vuestorefront:develop Jul 23, 2019
@patzick
Copy link
Collaborator

patzick commented Jul 23, 2019

Thanks @ResuBaka !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants