Updated Price Model TaxIncl methods & Cart Item TaxIncl properties to actually provide Tax inclusive values.#2411
Open
MacTavish-69 wants to merge 4 commits intolunarphp:1.xfrom
Open
Updated Price Model TaxIncl methods & Cart Item TaxIncl properties to actually provide Tax inclusive values.#2411MacTavish-69 wants to merge 4 commits intolunarphp:1.xfrom
MacTavish-69 wants to merge 4 commits intolunarphp:1.xfrom
Conversation
taxIncl methods internally work on default tax class basis. The moment you've more than 1 tax class, it stops working. Moreover, taxation works on cart when address is set. However, it's a standard use case to display Tax inclusive prices to user when they're from a tax eligible jurisdiction. This use case is not achievable with current way of Lunar. Hence, we need to have tax information on the cart which can take care of it. For one time situations where you need tax Incl price for a given zone, you can pass the zone as parameter
…ice NOT being taxInc as per set zone.
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.
Lunar Current Behavior
Fixes in PR
The PR approaches this problem at cart level and Price Model level.
Cart Level
We add TaxZone property to Cart model. The typical flow is to find the user country based on IP in middleware, determine the tax zone and set it on the cart. With this, The items added to cart, will correctly give tax incl price when taxInc methods are called.
Price Model Level
When we have Product/Purchasable instead of Cart Line (Item is added to cart), we get the price from prices relation (prices attached to purchasable) and utilize
priceIncTax,comparePriceIncTaxmethods. An optional TaxZone parameter is added so you can get the tax inclusive price as per the zone of your choice. This is useful when you need it for one time for any reason.Note: You can totally ignore it if you need the prices to be as per the zone set on cart, the PR will fallback to the zone set on cart.
Previous PR: #2406
The previous PR focused strictly on Product/Purchasable display prices. It introduced a taxzone parameter to specific methods, allowing developers to:
This PR is a superset of #2406. It retains the functionality mentioned above but expands it by adding a taxZone property directly to the Cart.
IMPORTANT:
Since this PR includes all changes from #2406, please reject/close that PR if you choose to merge this one.