-
-
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
Tax adjustments are not destroyed properly if there is more than one type of adjustable for relevant_items #909
Comments
Wow, that's a bug I didn't even know existed. This is fixed on the current master branch though. |
The line you're proposing is good in most cases, but will destroy adjustments you might not want destroyed, unfortunately. (Example: You have a promo adjustment with ID 1 and a line item adjustment with ID 1, your code would destroy both...) |
it still needs the If you changed line 90 to:
it should work fine |
That will still not be foolproof. You would possibly be deleting shipment
|
Ah ok, i see what you're saying now. This should do the trick:
|
That would work. Please submit a pull request as it does fix a bug.
|
True, but master does the same thing now that they extracted the code to Spree::Tax::ItemAdjuster. It only does 1 object at a time so i would have to loop over each item and do items.length SQL queries. |
I think this has been resolved in both master and Solidus 1.2. |
As a mentioned in solidusio#909, the current implementation of the taxation system destroys tax adjustments one item at a time. This commit changes that so all the order is stripped of all tax adjustments, resulting in less database calls.
Using solidus 1.2.
I am having problem with taxes not destroying tax adjustments properly when Spree::TaxRate.adjust(order_tax_zone, items) is called and items consists of an array of different class types.
For example, our store taxes shipping (since we upcharge). if "items" input contained all our line items and shipments in the order, then this line of code fails:
https://github.com/solidusio/solidus/blob/v1.2/core/app/models/spree/tax_rate.rb#L90
Lets say my relevant items contains a LineItem and a Shipment and i call line 90, this is the SQL query that active record returns:
As you can see in the SQL query, it is only looking for line items. Thus, it only returns the tax adjustment for the line item. if i called this line instead:
then i get back the tax adjustments for the line item and the shipment.
The text was updated successfully, but these errors were encountered: